I’m using some jquery to hide list elements when a page is loaded. When the code is static, it works fine, but the list elements are being generated dynamically via php and aren’t all available when the page is loaded. I’ve tried to attach the .hide to the load event, but get the error,
$(‘li.views-row’).live is not a function.
Code is all at http://jsfiddle.net/Ypqyv/, although because the html there already exists when you hit Run you can’t see the error. (No, I cannot post a link to the actual site; it’s on a dev server behind a firewall.)
Any ideas? I’ve read a whole bunch of answers here about issues with .live(), but none of them seem to apply to my situation.
ETA: using jquery 1.6.
I’m not sure why you are getting the error
.live is not a function error, however,.livewill not work in this situation anyway.<li>elements do not fire off anonloadwhen they are created, therefore a$("li").live("load",handler)will never get triggered anyway.http://w3schools.com/jsref/event_onload.asp
Instead, you should manipulate the list item right after the code that adds it to the page.