templates - weird behavior with jquery -


i've removed previous question because found problem in jquery itself.

imagine code :

var el = $('<ul><li/></ul><a id="clickme">click me!</a><p>').find('#clickme'); 

why clickme isn't found ?

because .find() looks descendants, use in case filter() instead:

var el = $('<ul><li/></ul><a id="clickme">click me!</a><p>').filter('#clickme'); 

demo

note: in html string, not closing <p> tag.


Comments

Popular posts from this blog

How to mention the localhost in android -

php - Calling a template part from a post -