thelolcat
thelolcat

Reputation: 11545

detect if input is hidden-type

I'm selecting a element with a certain name

$('[name="lol"]']

but there can be two elements with the same name, one of the is a hidden input field.

How can I ignore hidden input fields from the selector above?

$('[name="lol"]:not(:hidden)'] kind of works, but fails if the non-hidden input field is not visible on the screen... How can I specifically ignore only hidden-type inputs, not non-visible elements?

Upvotes: 1

Views: 95

Answers (3)

JaredPar
JaredPar

Reputation: 754545

It sounds like you're looking for <input type="hidden"> elements. If so then look specifically for the type="hidden" attribute

$('[name="lol"][type!="hidden"]')

Upvotes: 3

rainecc
rainecc

Reputation: 1502

Give them different id's and use that, rather than the name?

Upvotes: 1

Scorpion-Prince
Scorpion-Prince

Reputation: 3634

Use the :visible selector instead

Upvotes: 1

Related Questions