Use event delegation for dynamically created elements:
$(document).on("click", '.mylink', function(event) {
alert("new link clicked!");
});
This does actually work, here’s an example where I appended an anchor with the class .mylink
instead of data
– http://jsfiddle.net/EFjzG/
More Related Contents:
- How to send data to the server via Ajax?
- HTML: how refresh information in [closed]
- How to make page loaders/animations/transitions
- How to send FormData objects with Ajax-requests in jQuery? [duplicate]
- jQuery.click() vs onClick
- How to wait for the ‘end’ of ‘resize’ event and only then perform an action?
- Refresh/reload the content in Div using jquery/ajax
- Set timeout for ajax (jQuery)
- Using HTML5 file uploads with AJAX and jQuery
- Prevent Page Load on Jquery Form Submit with None Display Button
- Why is it a bad practice to return generated HTML instead of JSON? Or is it?
- “Mixed content blocked” when running an HTTP AJAX operation in an HTTPS page
- HTML5 dragleave fired when hovering a child element
- jquery submit form and then show results in an existing div
- Javascript regex returning true.. then false.. then true.. etc [duplicate]
- How do I abort image load requests without using window.stop()
- how to assign javascript variable value to php variable
- How to generate a thumbnail image after adding an image inside an input type=”file” in a form and submitting them both on the same form
- How to replace html element with ajax response?
- How to change URL in browser without navigating away from page?
- How can I get all a form’s values that would be submitted without submitting [duplicate]
- Bind events on dynamic created elements inserted by AJAX (check box)
- how to use jQuery ajax calls with node.js
- Trigger for span text/html on changed
- jQuery DataTables “No Data Available in Table”
- Twitter-style autocomplete in textarea
- Scrolling Overflowed DIVs with JavaScript
- jquery ajax parse response text
- Parsing returned HTML from jQuery AJAX request
- How to replace the entire html webpage with ajax response?