15

For example I have a css style like this :

    input.validation-passed {border: 1px solid #00CC00; color : #000;}

The javascript validation framework I use will inject every input tag with a class="validation-passed" .For the elements like <input type='text' /> ... , this is ok , but for <input type='button' /> , I want this is not applied , how should I do this ?

0

3 Answers 3

20
.validation-passed:not(input[type="button"]) {color:red;}
Sign up to request clarification or add additional context in comments.

1 Comment

It may be helpful to mention that this is CSS3 syntax that may not be fully supported by all browsers.
3

If you don't need to support IE6, you can use an attribute selector:

input[type="text"].validation-passed {border: 1px solid #00CC00; color : #000;}

2 Comments

+1 There's no IE6 CSS only way I know of to accomplish this anyway, no sense in worrying about it.
Thanks ,but I need to support IE6!
0

I don't think you can. But you can inject a little piece of javascript to parse your inputs and add the class text-validation-passed to all your text inputs with the class validation-passed (or remove the class from button input if you don't need it).

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.