In the example below
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js" type="text/javascript"></script>
</head>
<body>
<a href="#">test</a>
<button id="btn-add">Add</button>
<div id="placeholder">
</div>
<script type="text/javascript">
$(document).ready(function () {
$('a').on('click', function () {
alert('clicked');
});
$("#btn-add").on("click", function () {
$('#placeholder').prepend('<a href=\'#\'>blah2</a>');
});
});
</script>
</body>
</html>
If you click on ‘Add’ then ‘blah2’ nothing happens even though I am trying to alert on any anchor click. As a check if you click on ‘test’you get the popup
Try this instead:
Link to fiddle