views:

50

answers:

4

OK if I want to target an <input> tag with type="submit" I can do so like:

input[type=submit]

Also if I want to target an <input> tag with value="Delete" I can do so like:

input[value=Delete]

But How can I target an <input> tag with BOTH?

+11  A: 
input[type=submit][value=Delete]

You're chaining selectors. Each step narrows your search results:

input

finds all inputs.

input[type=submit]

narrows it to submits, while

input[type=submit][value=Delete]

narrows it to what you need.

MvanGeest
Great thanks!!!
John Isaacks
+1  A: 
input[value=Delete], input[type=submit] {
    /* css here */
}

This should do it!

Tom
This would also select submits that are not Delete and Deletes that are not submits. The user only wants submits (in fact a single one) that are (is) Delete.
MvanGeest
+1  A: 

You can use multiple attributes as follows:

input[type=submit][value=Delete] {
    /* some rules */
}
Pat
A: 

You can just chain the attribute selectors

input[type="submit"][value="delete"]

CEich