Im appending an input
to my html
markup but my event listener not working on this input
here is my code:
$('button').click(function(){
$('body').append('<input>')
})
$('input').on('keydown',function(e){
if(e.keyCode==13){
alert('ok')
}
})
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<button>Click me</button>