mrtsherman
mrtsherman

Reputation: 39872

jQuery attribute selector for multiple values

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.

Upvotes: 25

Views: 27043

Answers (2)

jabclab
jabclab

Reputation: 15042

This should help:

$('input[type="text"], input[type="button"]');

Upvotes: 41

ShankarSangoli
ShankarSangoli

Reputation: 69905

Try this

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

Upvotes: 13

Related Questions