javascript - Jquery on php in div box not working -


i have main php load php div box via dropdown list. loaded php contains table. there jquery in alert on row clicked.

$(document).ready(function() {     $('#newstable tr').click(function(){     var clickedid = $(this).children('td:first').text();     alert(clickedid);     }); }); 

but after loaded div, script not firing

use event delegation attach event. event delegation allows attach single event listener, parent element, fire descendants matching selector, whether descendants exist or added in future.

   $(document).ready(function() {      $(document).on('click','#newstable tr',function(){        var clickedid = $(this).children('td:first').text();        alert(clickedid);      });    }); // end 

Comments

Popular posts from this blog

node.js - How to mock a third-party api calls in the backend -

node.js - Why do I get "SOCKS connection failed. Connection not allowed by ruleset" for some .onion sites? -

matlab - 0-by-1 sym - What do I need to change in order to get proper symbolic results? -