alenan2013 alenan2013 - 1 year ago 83
Javascript Question

How to select multiple elements by id using jQuery

I have two radio buttons:

<label for="input_1">Path to Excellent </label>
<input id="input_1" name="radio" type="radio" value="1" />
<label for="input_2">Award of Excellence</label>
<input id="input_2" name="radio" type="radio" value="2" />

I would like to get val() from one of them using their ids: "input_1" or "input_2" by jQuery, something like this:


My aim is to get val() from one of them that is checked, by id. How can I do this?

Answer Source

You can check the starts of the id in this case:

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download