on click of button i am adding dynamic element eg: anchor tag having some id, on clicking the dynamic element alert should open which is not happening.
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
<script>
$(document).ready(function(){
$("#submit").on("click",function(){
$("#op").html("<a href='javascript:void(0)' id='demo'>Click</a>");
});
$("#demo").on("click",function(){
alert('In Demo....');
});
});
</script>
</head>
<body>
<button id="submit">Submit</button>
<pre id='op' ></pre>
</body>
</html>