Input vs :Input in jQuery

前端 未结 3 2003
清歌不尽
清歌不尽 2021-02-13 11:43

I wonder why people seems to prefer :input over input as a jQuery selector? Basically, this two lines seem to do the same thing :

$(\'i         


        
3条回答
  •  栀梦
    栀梦 (楼主)
    2021-02-13 12:03

    input is just the input element selector. :input also selects textarea, select, and button (form controls).

    It's not necessarily a matter of preference since in actuality they do somewhat different things.

提交回复
热议问题