Issue Description
If some HTML has been injected (using something like .append()
) and it contains a link, that link won’t work when clicked due to it not being present when the document was ready.
How to Fix the Issue
To allow the link to be clickable, you have to change the scope of the link’s click action.
For example, if you inject a video container with a close button and the container element has a data attribute like data-wrap="video"
, your JS would look like the snippet below:
Fixed Code Snippets
$('[data-wrap="video"]').on('click', '.video-outer--close', function() {
event.preventDefault();
// CODE TO ACTION GOES HERE
});