Jquery : Correct way to checkbox checked using jquery
As of jQuery 3, removeAttr does not set the corresponding property to false anymore:
here is common mistake to use .removeAttr( “checked” ) on a DOM element.
.prop( “checked”, false ) is the right way to checkbox checked.
Syntex Defination:
Use This
$(‘.checkeddata’).prop(‘checked’,true);
$(‘.checkeddata’).prop(‘checked’,false);Not Use
$(‘.checkeddata’).attr(‘checked’,true);
$(‘.checkeddata’).attr(‘checked’,false);
Share