Introduction to the use of jquery prop and the difference with attr


Prop and attr work similarly

Similarities: both can get and set property values Difference: when dealing with a checkbox, prop is recommended because the Internet explorer browser is not compatible, as it is recommended by all individuals alike RemoveProp (” XXX ”) removeProp(” XXX ”) Example: Get attribute value


var currentChecked=$(".my-checked").prop("checked");  A value of true/false

Setting property values


var currentChecked=$(".my-checked").prop("checked" . false);