skip to Main Content

How to select element by id which added using insertAfter? – Jquery

Using jquery I added an HTML button using insertAfter() now I would Like to select that button by id but didn't work. $("button").click(function(){ $("<button id='new-button'>Added Button</button>").insertAfter("#this"); }); $("#new-button").click(function(){ $("<span> #new-button-work</span>").insertAfter("#this"); }) <!DOCTYPE html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script> </head> <body> <button…

VIEW QUESTION
Back To Top
Search