JSFiddle - React, Tailwind, and code Playground
by yeuem1vannam
HTML
<input type="checkbox" id="xxx_1"/>
<input type="checkbox" id="xxx_2"/>
<input type="checkbox" id="xxx_3"/>
<input type="checkbox" id="xxx_4"/>
<input type="checkbox" id="xxx_5"/>
JavaScript
$.fn.xxx = function(name){
var xid = $(this).attr("id");
var btns = $("[id*='" + name + "']").filter(function(){
return (this.id > xid);
});
if($(this).is(":checked")){
$(btns[0]).removeAttr("disabled");
}else{
$(btns).each(function(){$(this).prop("checked", false)});
$(btns).attr("disabled", "disabled");
}
}
$("[id*=xxx]").click(function(){
$(this).xxx("xxx");
});