what I’m going to ask might not be possible, I’ll try to be as clear as possible.
I set up my website so that there is only one actual webpage (index.php). All the html and page content is stored in a php script. So I simply post for the data depending on the which page they want to view and .html() it within my page template. It all works great, just how I wanted.
The problem is that any jquery functions that use element tags that are within the html that I call from the server and render after the page load no longer work. I’m not really sure why this is happening. Does jquery render into memory all the page elements on the page load, so that ids and classes added post-page load are not considered?
Any insight, or different ways to do this would be appreciated.
Thanks in advance!
Sounds like you could use .delegate() which has more benefits than .live()
http://api.jquery.com/delegate
That allows you to attach events to elements on page load and those created after which is what you’re doing with .HTML()
With anything that you’re doing that is not event bound you should run all your jquery stuff right after you replace things on the page everytime. Not just on page load.
Put all of it into a function so you can call it easily.