How to jQuery plugin effects to items created later in the DOM
Posted
by
Dan Denney
on Stack Overflow
See other posts from Stack Overflow
or by Dan Denney
Published on 2010-12-27T17:24:12Z
Indexed on
2010/12/27
17:54 UTC
Read the original article
Hit count: 291
How do I apply jQuery plugin effects to items that are created by an event?
So, what I am attempting to do is have all uls throughout a site use the jquery.scroll.js plugin for styling. I currently have it working on all active uls. However, there are some category/subcategory sections. I am still new to writing any jQuery on my own and there is a leap in logic that I don't understand on applying plugins to items when they are loaded later.
In the real example, users click a category from a ul and a sub category is loaded via Rails and JSON. For a light sample, I made a jsfiddle that simulates the issue that I run into.
The category ul is styled correctly, but the subcategory ul doesn't pick up the styling. I'm hoping for some assistance not just in whipping up some code to fix it, but in pointing me in the direction of what I need to learn for this functionality.
http://jsfiddle.net/dandenney/25R8F/1/
Thank you in advance!
© Stack Overflow or respective owner