Reputation: 5859
Is it possible to do something like this in jQuery to select multiple input control so that I can bind the onchange event on all of them at the same time.
jQuery('div input[type=(text|select|radio|checkbox)]')
or is it something like this jQuery('div input[type=*]')
?
Upvotes: 2
Views: 427
Reputation: 342635
Check out the :input
selector:
jQuery("div :input").change(...
The API states that it "Selects all input, textarea, select and button elements".
If you are looking to select a subset of input types within a container, you could use the multiple selector, like this:
jQuery("div input[type=radio], input[type=text]").change(...
Upvotes: 2