JQuery obtains the Value of Radio and CheckBox.
This article mainly introduces jQuery to obtain Radio and the Value selected by CheckBox in detail. If you need it, you can refer to it for help.
$ ("Input [name = 'Radio _ name'] [checked]"). val (); // select the Value of the selected radio
$ ("# Text_id"). focus (function () {// code...}); // event triggered when the object text_id gets the focus
$ ("# Text_id"). blur (function () {// code...}); // triggered when the focus of the object text_id is lost
$ ("# Text_id"). select (); // set the Vlaue value of the text box to the selected status.
$ ("Input [name = 'Radio _ name'] [value = 'value to select the Value of radio '").
Attr ("checked", true); // set Radio to the selected status based on the Value.
JQuery obtains the Value selected by the CheckBox.
$ ("Input [name = 'checkbox _ name'] [checked]"); // select the set of checked checkbox elements. If you want to get the Value, you need to traverse the set.
$ ("Input [name = 'checkbox _ name'] [checked]").
Each (function () {arrChk + = this. value + ',' ;}); // traverses the set of checked CheckBox elements to obtain the Value.
$ ("# Checkbox_id"). attr ("checked"); // gets the status of a CheckBox (true/false if any CheckBox is selected)
$ ("# Checkbox_id"). attr ("checked", true); // set the status of a CheckBox to select (checked = true)
$ ("# Checkbox_id"). attr ("checked", false); // set the status of a CheckBox to unselected (checked = false)
$ ("Input [name = 'checkbox _ name']"). attr
("Checked", $ ("# checkbox_id"). attr ("checked"); // you can analyze the meaning of the code based on 3, 4, and 5.
$ ("# Text_id"). val (). split (","); // returns an array separated ','.