Also found that their own JavaScript code in Firefox run under the error, the reason is very depressed, in the acquisition of a radio element of the value of the time only to get the undefind.
Google a bit, most of the way I used is the same
Copy Code code as follows:
var value = $ ("input[name= ' Radio1 '][type= ' Radio '][checked]"). Val ();
This sentence in IE, Safari (3.2) under the test, but in Firefox, Chrome but not the selected value.
Take a closer look at the manual and find the list of "Form Object Properties". Does it mean that there is a way to determine a specific attribute for a form object? Change the code.
Copy Code code as follows:
var value = $ ("input[name= ' Radio1 '][type= ' Radio ']:checked"). Val ();
In IE, FireFox, Chrome, Safari (3.2) under the test are passed.
By the way, I tested the select element, and the manual was written in a common style, and I could get the correct values in the above browsers.
Copy Code code as follows:
var value1 = $ ("select"). Val (); var value2 = $ ("Select Option:selected"). Val ();
I tested it in the jquery version 1.32 and you can try it.