I also found that the JavaScript code I wrote ran incorrectly under FireFox. The reason was very frustrating. When getting the value of a Radio element, I only got undefind.
Googled it, and most of them are the same as the method I used
var value = $("input[name='radio1'][type='radio'][checked]").val();
This sentence is in IE and Safari The test passes under (3.2), but the selected value cannot be obtained under FireFox and Chrome.
Read the manual carefully and find the list of "Form Object Properties". Could it be said that there is a special attribute judgment method for form objects? Change the code
var value = $("input[ name='radio1'][type='radio']:checked").val();
The test passed under IE, FireFox, Chrome, and Safari (3.2).
By the way, I tested the select element. The way it is written in the manual is the way I usually write it. The correct value can be obtained in the above browsers.
var value1 = $("select").val( ); var value2 = $("select option:selected").val();
I tested it under jQuery 1.32 version, you can try it.