[Solved] jQuery: onclick method for every buttons with id starting with [duplicate]


Method 1:

$('[id^="del"]').click(function() { //ID begins with "del"
    //code here
}); 

//or

$(document).on('click', '[id^="del"]', function(e) {
     //code here
});

Method 2: Add a common class to all your buttons:

$('.myButton').click(function(){/*code..*/});

solved jQuery: onclick method for every buttons with id starting with [duplicate]