The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Dynamic content: how to get javascript functions working?

  • This topic is empty.
Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
  • #32257

    on this site there’s a screencast about dynamic content:

    it works fine but there are alot of people having the same problem as me and have no clue how to solve it..
    when you load a page that has javascript functions they won’t work!
    I already wasted so many hours of googling for the answer but still no luck. I read about replacing .bind() with .live() but didn’t get it to work..anyone?!


    Are you saying you’re loading new Javascript functions within the Dynamic Content? i.e. you click a button that brings in new content and in that content is a script tag with a Javascript function?

    Or, when you load in the dynamic content, existing events like mouseover and click will not fire on the fire content?

    Got a live link to the site or code?


    Hey TT_Mark,
    In the new content is f.e. a lightbox plugin but it doesn’t work..same for all plugins

    you can see it here:

    code is here:



    Hmm…so in the new content you have some ‘inline’ Javascript? or its actually linking to an external script e.g.

    I dont think the latter will work, not sure if the former works either…

    Can you not have the plugin always in the source code, whatever content is showing?

    Chris Coyier

    It really is all about using .live() or .delegate(), or rebinding events every time you load in new content.

    I haven’t look at that tutorial in a while, but I’m sure it uses .load() to pull in HTML from the other pages. With .load() you can declare a callback function. Callback functions are functions that fire once the function calling it is totally done doing it’s thing, meaning in this case the HTML has been injected and it’s ready to go. In that callback function, you’d re-bind any events attached to elements that you need to work.


    Thanks for the reply’s! going to give it another try..

    Member can add loading… image gif animation for this( when content loading?

Viewing 7 posts - 1 through 7 (of 7 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.