The following is a small example of how to obtain the selected Radio Value in the Form, if you are interested, you can refer to the selector provided by Jquery, which greatly facilitates the Dom operations by developers and truly simplifies the code, but has powerful functions. The following is a small example of how to obtain the selected Radio Value in the Form that is most commonly used.
The form is as follows:
The Code is as follows:
Then, how can we obtain the selected radio value? Juqery provides the following methods for us:
The Code is as follows:
$ ("Input [name = 'optype']: checked"). val () ------- this method is widely used and easy to understand.
$ ("Input: radio: checked"). val (); --------- this method is the easiest, but it is not easy to understand when using selector.
$ ("Input [@ name = 'optype'] [checked]"); -------- write [@ checked = checked] In the power method. This is what I wrote for the first time.
Then, we also need to traverse radio occasionally. What should we do? Of course, each is required to appear, as follows:
The Code is as follows:
$ ('Input [name = "commandid condition opType"] '). each (function (){
Alert (this. name + this. value );
});
I should have understood it. If you have any better methods, you are welcome to build a building.