That :input voodoo is a perfectly cromulent jQuery selector that can serve to embiggen the flexibility of your code. It matches all form controls, such as input, textarea, select and button elements.
The problem is that there’s no gap, without which means that it’s looking for form elements that are also form controls, which are mutually exclusive.
Put a space in there and it will then match what you want correctly.
$('#signup form :input')
If you want to restrict it to only input fields (no other type of form control) then the suggestion from Ralph’s post will work too.
form:input is looking for a form element that is also a form control. Since a form element is not a form control, you get no match.
Whereas form :input is looking inside forms for elements that are form controls.
If it helps, consider div.header
That too is getting only div elements that also have that class name. Their descendants do not come in to things at this point.
With div .header though, that’s getting all elements within the div that contain the appropriate class.
thanks, I got confused when I saw the following code after your initial explanation, I was thinking along the right lines but got the example wrong in my previous post.
$('.check-all:checkbox').change(function() {
var group = ':checkbox[name=' + $(this).attr('name') + ']';
$(group).attr('checked', $(this).attr('checked'));
});