1. Obtain a value of type text or Areatext
var textval = $ ("#text_id"). attr ("value");
var textval = $ ("#text_id"). Val ();
2. Get the value of a radio button
var Valradio = $ ("input[type=radio][checked]"). Val ();
3. Gets the value of a set of radio selected items named (items)
var item = $ (' input[@name =items][@checked] '). Val ();
4. Get the value of the check box
var checkboxval = $ ("#checkbox_id"). attr ("value");
5. Get the value of the drop-down list
var selectval = $ (' #select_id '). Val ();
6. Text box, text area
$ ("#text_id"). attr ("Value", "");//Clear Contents
$ ("#text_id"). attr ("value", ' test ');//fill content
7. Multiple marquee checkbox
$ ("#chk_id"). attr ("Checked", "");//Make it unchecked
$ ("#chk_id"). attr ("Checked", true);//tick
if ($ ("#chk_id"). attr (' checked ') ==true)//Determine if selected
8. Radio Group Radio
$ ("input[@type =radio]"). attr ("Checked", ' 2 ');//Set value=2 for the currently selected item
9. Drop-down box select:
$ ("#select_id"). attr ("value", ' test ');//Set Value=test item as the current selection
$ ("<option value= ' test ' >test</option><option value= ' test2 ' >test2</option>"). AppendTo ("# select_id ")//Add drop-down box option
$ ("#select_id"). empty ();//Empty drop-down box
10. Gets the value of a set of radio selected items named (items)
var item = $ (' input[@name =items][@checked] '). Val ();//If Unchecked, val () = undefined
11. Get the text of select selected item
var item = $ ("select[@name =items] option[@selected]"). Text ();
The second element of the Select drop-down box is the currently selected value
$ (' #select_id ') [0].selectedindex = 1;
Radio the second element of a radio group is the currently selected value
$ (' input[@name =items] '). Get (1). checked = true;
Summary of the methods of value and assignment of common HTML elements