Gaurav
Gaurav

Reputation: 8487

Can we put OR condition in .find() function

I am trying to do something like :

$(".test").find("button or input[type=button]")

How can i do this?

Upvotes: 2

Views: 456

Answers (3)

Rab
Rab

Reputation: 35572

$(".test").find("button, input[type=button]")

Upvotes: 2

core1024
core1024

Reputation: 1882

Just use comma ie $(".test").find("button, input[type=button]");

Upvotes: 3

lonesomeday
lonesomeday

Reputation: 237975

Yes, it's called the multiple selector and it's a comma:

$(".test").find("button, input[type=button]")

For the sake of completeness, note that :button does exactly this, but will be slower in pretty much all modern browsers.

Upvotes: 4

Related Questions