Jquery selector input[type=text]')

前端 未结 4 1137
不思量自难忘°
不思量自难忘° 2020-12-23 03:01

I wrote a code that basically selects all input type=text element like this:

$(\'.sys input[type=text]\').each(function () {}

4条回答
  •  心在旅途
    2020-12-23 03:24

    $('.sys').children('input[type=text], select').each(function () { ... });
    

    EDIT: Actually this code above is equivalent to the children selector .sys > input[type=text] if you want the descendant select (.sys input[type=text]) you need to use the options given by @NiftyDude.

    More information:

    • jQuery.children()
    • multiple selector

提交回复
热议问题