I\'m borrowing/adapting this simple html/javascript form set up to put some data in the database. The original code uses text fields in the form, but I\'m using radio button
Since you are using jQuery you can easily get the value of the selected radio button by using the :checked selector:
$("input[name=interview]:checked").val()
You should definitely not give more than one element the same ID (that's invalid HTML and will lead to confusing bugs in your JavaScript), but even if that worked it wouldn't help in this case since radio buttons as a group don't have a selected value: you need to determine which one is currently checked and then get its value as shown above. (This is not a problem when getting the value on the webserver when the form is actually submitted, because only the value from the checked radio gets submitted.)
Note also that in your original code where you said inputUser.attr("value")
, you could've said inputUser.val()
.