jQuery cant select html tags that appended by jQuery?
- <!DOCTYPE html>
- <html>
- <head><script src=js/jquery-1.4.2.min.js></script></head>
- <body>
- <span id="add">Click to add button</span>
- <div id="content">
- </div>
- <input name="outside" type="button" value="original">
- <script>
- $("body input[type=button]").click(function()
- { alert('YES!!');
- });
- $("body > #add").click(function()
- { $("body > #content").append("<input type=\"button\" value=\"created with jquery\">");
- });
- </script>
- </body>
- </html>
When we click on the "original" button,it pops out a message,but the "created with jquery" button that created by clicking "Click to add button" doesn't pop out any message box.
Could someone tell me how to fix it?