jQuery: how to find first visible input/select/textarea excluding buttons?

前端 未结 6 803
终归单人心
终归单人心 2020-12-03 00:36

I tried

$(\":input:not(input[type=button],input[type=submit],button):visible:first\")

but it doesn\'t find anything.

What is my mis

6条回答
  •  不思量自难忘°
    2020-12-03 00:51

    This is an improvement over @Mottie's answer because as of jQuery 1.5.2 :text selects input elements that have no specified type attribute (in which case type="text" is implied):

    $('form').find(':text,textarea,select').filter(':visible:first')
    

提交回复
热议问题