I also found that the JavaScript code I wrote had an error running in FireFox. The reason was very depressing. When I got the value of a Radio element, I only got undefind. Google, most of the methods I use are the same 1 varvalue $ (& quot; input [name & amp; #39; radio1 & amp; #39;] [ty...
I also found that the JavaScript code I wrote had an error running in FireFox. The reason was very depressing. When I got the value of a Radio element, I only got undefind.
Google, most of them are the same as what I use
1
Var value = $ ("input [name = 'radio1'] [type = 'radio'] [checked]"). val ();
This statement is successfully tested in IE and Safari (3.2), but cannot be selected in FireFox or Chrome.
Read the manual carefully and find the list of "form object attributes. Is there a special method for determining the attributes of a form object? Change the code
1
Var value = $ ("input [name = 'radio1'] [type = 'radio']: checked"). val ();
All tests passed in IE, FireFox, Chrome, and Safari (3.2.
By the way, I tested the select element. The method in the manual is similar to the one I often use. The correct value can be obtained in the preceding browsers.
1 2
Var value1 = $ ("select"). val (); var value2 = $ ("select option: selected"). val ();
I tested it in jQuery 1.32. You can try it.
From the PHP website of shunzi Network