0

I'm curious about the JQuery html selector limitation. For a test, I wrote a simple code that add before/after an element something else. And I found that the new element isn't detected by the selector.

            $("li").dblclick(function() {
                $(this).before("<li>*****</li>");
                $(this).after("<li>*****</li>");
            });

I add two <li> when I click on a <li> (one before and one after). The code work for all of them excepted the new one. If I click on a <li>*****</li> nothing happen.

Does JQuery use a list of all html tags and forget to update it when adding some code ?

If someone can explain that for me, I dind't find anything useful on the web :/

EDIT: I don't ask how to use it, I want to find documentation on why there are a difference between previous element and new one

Tutul
  • 99
  • 7

0 Answers0