JQuery difference in the prop and attr, checked add and delete

First, the problem

$ ( "# swIdInForm") removeAttr ( "the checked." ); 
$ ( . "#swIdInForm") attr ( "the checked", "to true"); // increase again does not work

 RemoveAttr after use () to remove the radio checked property, use attr () again to increase ineffective;

Second, the solution

$("#swIdInForm").removeAttr("checked");
$("#swIdInForm").prop('checked',true);

    Use prop () to reconfigure the property
    Note: true and false have two properties, such as checked, selected or disabled using prop (), others use attr ().

 

 Unfinished. . .

Guess you like

Origin www.cnblogs.com/trnanks/p/11332489.html