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" />
This question is related to
css
attributes
css-selectors
For concatenating it's:
input[name="Sex"][value="M"] {}
And for taking union it's:
input[name="Sex"], input[value="M"] {}
[class*="test"],[class="second"] {
background: #ffff00;
}
Concatenate the attribute selectors:
input[name="Sex"][value="M"]
Just to add that there should be no space between the selector and the opening bracket.
td[someclass]
will work. But
td [someclass]
will not.
Source: Stackoverflow.com