开发者

How to let css selector exclude an element?

开发者 https://www.devze.com 2022-12-24 20:13 出处:网络
For example I have a css style like this : input.validation-passed {border: 1px solid #00CC00; col开发者_如何学编程or : #000;}

For example I have a css style like this :

    input.validation-passed {border: 1px solid #00CC00; col开发者_如何学编程or : #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 ?


.validation-passed:not(input[type="button"]) {color:red;}


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;}


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).

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号