I have a problem selecting a checked radio button with jquery. The radio buttons are generated by a function from a MVC that i’d rather not change and its name is like id[number].
Simply put, I have to check if any of these buttons are checked:
<input type="radio" name="id[1]" value="1"/>
<input type="radio" name="id[1]" value="2"/>
The problem is that jQuery('input:radio[name=id[1]]:checked').val() will select some function from the jQuery library.
Any help will be much appreciated.
Are you sure you put the parentheses after val? When I’ve seen “some function from the jQuery library” showing up as a result, it’s generally because I put “val” instead of “val()”.