CSS selectors - how to select 'for' in CSS?

前端 未结 3 735
执笔经年
执笔经年 2020-12-10 14:26

I\'m using jQuery validation.

When for is now valid, validator is creating those:

3条回答
  •  孤街浪徒
    2020-12-10 15:12

    Any attribute can be selected with CSS or jQuery using the [] notation. CSS applies to any XML-like syntax, not just HTML -- it doesn't know (or care) what attributes are "valid" as long as the structure is well-formed.

    .error[for='username'] {
    
    }
    

    or for a "starts with"

    .error[for^='userprefix'] {
    
    }
    

提交回复
热议问题