Apply jqueryUI interaction attributes to newly added DOM elements?
So I start off with an element of class="list" that are defined as .sortable. Now if I cr开发者_运维知识库eate another element of class="list" via jquery, it does not inherit the same definition that I had already defined.
Now, I got around that by throwing the definition into a function and then call the function upon initial load and as well as every time I add a new element. Is this the best method? Or is there a more appropriate method of doing this?
http://jsfiddle.net/S24d4/11/
You probably want jQuery's .live() function. This will bind things to DOM elements added later.
精彩评论