I want to execute a function to remove the styling in one of my tables when a button with id reset is clicked and on using jquery selectors, I am unable to do so with the following code
$('#reset').on('click', function(){
$('td').removeAttr('style');
});
But it works when I put it like this
$('body').on('click', '#reset', function(){
$('td').removeAttr('style');
});
What am I doing wrong in the id selection.