0

I've this code:

 document.getElementById('form1').innerHTML = user_selections.stockyard_html[sel];

 alert('click handler registered');
 $("#" + register_btn_id).click(function (event){
alert("Clicked");
});

After html overwrite of form html which was saved yesterday, there is a register button whose click I'm not able to catch. What could be the reason?

Ned Howley
  • 828
  • 11
  • 19
user5858
  • 1,082
  • 4
  • 39
  • 79

1 Answers1

0

Put it inside document ready:

$(function() {
   $("#" + register_btn_id).on('click', function(e) {
       alert('clicked')
   )}
})
Daniele Dolci
  • 884
  • 1
  • 9
  • 22