JQuery: find child elements from an existing selector

后端 未结 4 598
终归单人心
终归单人心 2020-12-06 19:09

Im sure the solution is simple but I cant figure it out :( I need to combine two jquery selectors in one selector:

$(this) + $(\'input[type=text]:first\')


        
相关标签:
4条回答
  • 2020-12-06 20:05

    You can use multiple comma-separated selectors:

    http://api.jquery.com/multiple-selector/

    0 讨论(0)
  • 2020-12-06 20:08

    Just use .find():

    Get the descendants of each element in the current set of matched elements, filtered by a selector.

    $(this).find('input[type=text]:first').focus();
    

    or set the context to this:

    $('input[type=text]:first', this).focus();
    
    0 讨论(0)
  • 2020-12-06 20:11
    $(this).children('#inpouter[type=test]:first').focus();
    

    Should do the trick...

    0 讨论(0)
  • 2020-12-06 20:16

    I think you are looking for:

    $('input[type=text]:first', this).focus();
    

    It will focus the input box in the context of div#selected

    0 讨论(0)
提交回复
热议问题