Jquery read check box Value
<! Doctype html public "-// w3c // dtd xhtml 1.0 transitional // en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd">
<Html xmlns = "http://www.w3.org/1999/xhtml">
<Head>
<Meta http-equiv = "content-type" content = "text/html; charset = gb2312"/>
<Title> check box value for jquery reading </title>
</Head>
<Body>
Str = "input [@ name = opt"] [@ checked] ";
Alert ($ (str). val (); // ($ (str). val () is selected.
3. Read all the content whose IDs are blank:
// Use fuzzy query to read all IDs starting with blank
$ ("Input [id ^ = blank" + (I + 1) + "]"). each (function (){
Alert ($ (this). val ());
});
IV,
$ ("Input [type = checkbox] [checked]"). each (function (){
Alert ($ (this). val ());
})
// If $ ("input [type = checkbox] [checked]"). val () is used, only the first selected value is returned.
Instance
Html code:
<Form>
<Input type = "checkbox" name = "newsletter" checked = "checked" value = "daily"/>
<Input type = "checkbox" name = "newsletter" value = "weekly"/>
<Input type = "checkbox" name = "newsletter" checked = "checked" value = "monthly"/>
</Form>
Jquery code:
$ ("Input: checked ")
Using jquery to determine whether to checked the webpage effect, you only need a simple code. The details are as follows:
Select $ ("input: checked"). each (function (){
Var checktypevaluearr = $ (this). val ();
Alert ("checktypevaluearr =" + checktypevaluearr );
});
Retrieve the values in a single check box:
$ (This). val (); or $ ('# checkid'). val ();/body>
</Html>