What is the syntax for doing something like:
input[name="Sex" AND value="M"]
Basically, I want to select the input
element that has the attribute name="Sex"
as well as the attribute value="M"
:
<input type="radio" name="Sex" value="M" />
Elements such as the following should not be selected:
<input type="radio" name="Sex" value="F" />
Best Answer
Simple
input[name=Sex][value=M]
would do pretty nice. And it's actually well-described in the standard doc:As a side note, using quotation marks around an attribute value is required only if this value is not a valid identifier.
JSFiddle Demo