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
  • 748
  • 9
  • 19
user5858
  • 1,004
  • 2
  • 35
  • 72

1 Answers1

0

Put it inside document ready:

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