I am trying to select all radio buttons with a name, but I can only select the checked ones. For example this works:
$("input[@name='id']:checked").each(function() { // });
It selects all inputs with name id, which are checked (in this case one radio button). But I need all of them, as I need the not checked ones for this name, on this function.
This, for example, is not doing anything:
$("input[@name='id']").each(function() { // });
What do I do?
Thanks!
Try this instead:
$('input[name="yourName"]').each(function () { ... });
http://jsfiddle.net/sFtdR/
Try this
$(':input[type="radio"]').each(function(index){
// YOUR CODE
});
above code will select all input element who's type attribute is radio.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With