- This topic is empty.
Viewing 2 posts - 1 through 2 (of 2 total)
Viewing 2 posts - 1 through 2 (of 2 total)
- The forum ‘JavaScript’ is closed to new topics and replies.
The forums ran from 2008-2020 and are now closed and viewable here as an archive.
Home › Forums › JavaScript › jQuery .load() – Can’t hook loaded content.
Hi Everyone,
I am pulling out my hair again! I have a main page which loads 4 sections of content using the .load() jQuery function. The problem that I am having is that having loaded that content I want to hook into elements of that content and manipulate them using jQuery code in my main page’s header. It seems that the new content is present in the HTML (as it displays just fine) but I can’t get a hook into the elements like ul, li or div etc. like it’s missing from the DOM?!?
Having looked in Firebug I can see that all the HTML is OK and all the attributes are as I expect them to be with ID’s and classes where specified. I tried:
in my script and sure enough in the console it output the array of ul elements from my main page but not from any of the content inserted by .load(). The code for manipulating the loaded elements is placed after the code for loading the content. After much digging and head scratching I found a reference to the .live() event which seemed to be along the lines of what I need but I couldn’t understand quite what .live() does and how it would fit into my code.
Here’s a snippet of my code:
As usual all help is massively appreciated.
Paul.
Sorry, should mention that I have tried this in Safari and Firefox (both latest versions) on Mac OS X 1.6.2 and jQuery 1.3.2.