Jquery: Selection within a selection

后端 未结 3 1719
慢半拍i
慢半拍i 2020-12-07 03:41

I have an array of different elements stored from a previous selection, call it \'a\'.

How do i then do another select from this previous selection (

相关标签:
3条回答
  • 2020-12-07 04:03
    a.filter('input').each(function() {
        alert('My name is ' + $(this).attr('name'));
    });
    

    To just get 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

    0 讨论(0)
  • 2020-12-07 04:13
    $(a).find("input")
    
    0 讨论(0)
  • 2020-12-07 04:19
    $('input', a);
    
    0 讨论(0)
提交回复
热议问题