Is there a way to select multiple input field type

2020-05-21 07:42发布

I have a text and a password input field that I'm trying to select in this fashion:

input[type=text][type=password]

however this does not work. I would refrain from using jQuery, so any help would be appreciated (without using custom classes).

1条回答
混吃等死
2楼-- · 2020-05-21 08:40

You need to specify the attributes separately, repeating the types if necessary and using comma(s):

input[type=text], input[type=password]

Your given selector is trying to match an input with a type that is both text and password, but a single element can't have different values for the same attribute so it fails.

查看更多
登录 后发表回答