JQuery: selection within a selection

I have an array of different elements saved from a previous selection, name it. ' a'

How to make the next selection from this previous selection ( a) and just return type elements input?

+3
source share
3 answers
a.filter('input').each(function() {
    alert('My name is ' + $(this).attr('name'));
});

To simply select a selection from the current selection this way:

var $inputs = a.filter('input');

You can even comma separate selectors:

var $els = a.filter('input, .fooMonger, #something');

See http://docs.jquery.com/Traversing/filter

+6
source
$('input', a);
+2
source
$(a).find("input")
0

Source: https://habr.com/ru/post/1714981/


All Articles