1

I'd like to get a Jquery object of a specific class which has a specific value.

For example, I have these input tags with the class name "track-interval".

<input type="radio" class="track-interval" value="1" name="interval" />
<input type="radio" class="track-interval" value="5" name="interval" />

The first one has a value "1" and the second one has a value "5". Actually, in the real code that I'm working on, I have more input tags that have the same class name.

Now, I'd like to get a Jquery object of a input tag whose class name is "track-interval" and whose value is "5".

var trackInterval = $(".track-interval);

I know how to get a Jquery object whose class name is "track-interval".

But, I don't know how to get a Jquery object whose class name is "track-interval" and also whose value is "5".

Please help me out.

Thanks in advance.

4

1 回答 1

1

尝试这个:

var trackInterval = $(".track-interval[value=5]");

演示在这里

于 2013-09-14T14:44:38.127 回答