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

前端 未结 6 799
终归单人心
终归单人心 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:49

    Why not just target the ones you want (demo)?

    $('form').find('input[type=text],textarea,select').filter(':visible:first');
    

    Edit

    Or use jQuery :input selector to filter form descendants.

    $('form').find('*').filter(':input:visible:first');
    

提交回复
热议问题