user1032531
user1032531

Reputation: 26341

Find all elements except those of a given attribute using jQuery

How would I do the following, but exclude any hidden inputs?

$("#new-ticket").find('input,select,textarea').val('');

Upvotes: 0

Views: 53

Answers (1)

adeneo
adeneo

Reputation: 318372

With :visible

$("#new-ticket").find('input,select,textarea').filter(':visible').val('');

or

$("#new-ticket").find(':input:visible').val('');

the :input selector selects all input, textarea, select and button elements.

Upvotes: 5

Related Questions