Using a normal css selector:
$('.sys input[type=text], .sys select').each(function() {...})
If you don't like the repetition:
$('.sys').find('input[type=text],select').each(function() {...})
Or more concisely, pass in the context
argument:
$('input[type=text],select', '.sys').each(function() {...})
Note: Internally jQuery
will convert the above to find()
equivalent
Internally, selector context is implemented with the .find() method, so $('span', this) is equivalent to $(this).find('span').
I personally find the first alternative to be the most readable :), your take though