How does jquery obtain the radio value?
Use jquery to obtain the radio value. The most important thing is to know how to use the jquery selector. in a form, we usually need to obtain the selected radio.
So you need to add checked for filtering, such as the following radio items:
1.Jquery gets the radio Value
2.Jquery obtains the checkbox Value
3.Jquery obtains the select Value
To obtain a radio value, you can use the following methods:
1. 1. $ ('input [name = "testradio"]: checked'). val ();
2. 1. $ ('input: radio: checked'). val ();
3. 1. $ ('input [@ name = "testradio"] [checked] ');
4. 1. $ ('input [name = "testradio"] '). filter (': checked ');
It's almost complete. If we want to traverse all radio whose name is testradio, the Code is as follows: 1. $ ('input [name = "testradio"] '). each (function ()
{Alert (this. value );});
If you want to obtain a specific radio value, such as the Second radio value, write
1. $ ('input [name = "testradio"]: eq (1) '). val ()