I want to dynamic click on first click of paragraph but its not working.
$(document).ready(function() {
$(".newclass").click(function() {
var append_code = '<a href="google.com" class="hrefclick">Youre clicked</a>';
$('body').append(append_code);
$(".hrefclick").click();
$(document).on('click', '.hrefclick', function(e) {
alert("yess! You're clicked");
// do whatever
});
});
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<p class="newclass">
Hit me!
</p>
on()event handler for the.hrefclickelement