25

Given the following html, is there a selector that allows me to get both based on type?

<input type="text"  />
<input type="button"  />

 

$('input[type=text || button]'); //for example, double pipes as an OR does not work 

I went through the docs, but I couldn't find anything on the ability to use logical operators or a means of providing a matching list.

1

2 Answers 2

41

This should help:

$('input[type="text"], input[type="button"]');
Sign up to request clarification or add additional context in comments.

1 Comment

Is there really no better solution to this? I was afraid this might be a little performance waisting compared to a "value1|value2" solution, but there's no other way in CSS3 either, so I started searching. Well, I just hope jQuery has done it's best in terms of optimizations.
13

Try this

$("input:text, input:button");

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.