My page creates multiple buttons as id = \'rbutton_\"+i+\"\'. Below is my code:
This is the simplest way in my opinion:
// All buttons where id contains 'rbutton_'
const $buttons = $("button[id*='rbutton_']");
//Selected button onclick
$buttons.click(function() {
$(this).prop('disabled', true); //disable clicked button
});
//Enable button onclick
$('#enable').click(() =>
$buttons.prop('disabled', false) //enable all buttons
);