I found found several question's answers similar to this, I tried some of them, but no luck. May my scenario is different, I want to make other checkbox disable when anyone of them is clicked. if one is clicked second go disabled.
Edit:
I have two checkboxes i.e; chk1 and chk2. if chk1 is checked chk2 become disable, if chk2 is checked chk1 become disable
HTML
JS
$(function () { // I am also adding class to checkbox through JS
$('.cart-item-row > td > input[type="checkbox"]').addClass("class2");
});
//$('input[class^="class"]').click(function () {
//$('.class2').unbind().click(function () {
$('.class2').click(function () {
var $this = $(this);
if ($this.is(".class2")) {
if ($this.is(":checked")) {
$(".class2").not($this).prop({ disabled: true, checked: false });
} else {
$(".class2").prop("disabled", false);
}
}
});
JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)