Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to select any element (inputs, selects, textareas) with an specific name with JQuery

I have various inputs, selects and textareas in a form. I'd like to select one of them based on name without knowing the type of the element with jQuery. I know I can do something like

$("input[name=foo], textarea[name=foo], select[name=foo]")

but I wonder if I can do it in a more concise way. What do you say?

like image 871
brandizzi Avatar asked Oct 27 '10 18:10

brandizzi


1 Answers

http://api.jquery.com/input-selector/

:input[name=foo]

like image 192
Anpher Avatar answered Oct 20 '22 01:10

Anpher