In jQuery, how do I select an element by its name attribute?

This should do it, all of this is in the documentation, which has a very similar example to this:

$("input[type="radio"][name="theme"]").click(function() {
    var value = $(this).val();
});

I should also note you have multiple identical IDs in that snippet. This is invalid HTML. Use classes to group set of elements, not IDs, as they should be unique.

Leave a Comment