.click() and .submit() functions do not work on HTML Elements inserted after page has loaded
Hi,
I have a page that inserts a div after another div on my page. Basically this div and its content are generated by the server and outputted via Ajax when the user clicks a button.
I have something like:
- //Listener function
- $("div").click( function () {
- alert("thing");
- });
Clicking any of the divs that were loaded on the page will give this alert however, clicking on this div that was inserted after the user clicks a button does not respond to this listener. I put my rendered html into the w3c validator and my page has no errors (because I thought that maybe I had a missing end tag which would cause jquery to not work).
Can someone verify this?