In the development of radio often used to achieve the user's choice, I have accumulated some of the project using jquery to operate the radio method, here to share, for the needs of friends for reference.
1, change the choice of radio, trigger some effect
Copy Code code as follows:
$ ("Input:radio[name= ' Dialcheckresult ']"). Change (function () {//Dial
Alert ("123");
});
2. Make all the radio in the page available.
$ ("Input:radio"). attr ("disabled", false);
3, so that all the radio on the page is not available.
$ ("Input:radio"). attr ("Disabled", "disabled");
4, let a radio placed in the selected state.
$ ("Input:radio[name= ' Dialcheckresult ']"). EQ (0). attr ("Checked", true);
5, let the page "unchecked" status of the radio is not available.
$ ("Input:radio:not ([checked])"). attr ("Disabled", "disabled");
6, traverse the selected state of the radio, in addition to a certain radio, the other "checked" status of the radio set is "not selected" state.
Copy Code code as follows:
$ (' input:radio:checked '). each (function (i,val) {
if (val.name!= "Dialcheckresult") {
$ ("Input:radio[name= '" +val.name+ "']:checked"). attr (' checked ', false);
}
});
7, so that all "unchecked" status of the radio is not available.
$ ("Input:radio:not ([checked])"). attr ("Disabled", "disabled");
8, get a selected radio of the specific name of the value.
var dialcheckresult=$ ("Input:radio[name= ' Dialcheckresult ']:checked"). Val ();
9, let all the "checked" status of the radio placed in the "unchecked" state.
$ (' input:radio:checked '). attr (' checked ', false);
10, let the page radio are placed in the "checked" status or "unchecked" status.
$ ("Input:radio"). attr ("Checked", true);
$ ("Input:radio"). attr ("checked", false);