jQuery selector question (how to select all input fields on a form EXCEPT buttons and checkbox)

前端 未结 2 1939
醉话见心
醉话见心 2021-01-03 17:47

I am trying to select all input fields on a form (except buttons and checkboxes).

I have got as far as to select all the form input elements on a form with id \"myfo

相关标签:
2条回答
  • 2021-01-03 18:34
    $("#myform :input:not(:checkbox):not(:button)");
    
    0 讨论(0)
  • 2021-01-03 18:42

    You can use :not() combined to :checkbox and :button selectors:

    $("#myform :input:not(:button):not(:checkbox)");
    

    and test it with success with the example provided in the documentation of :input

    EDIT: :input also selects textarea, select, button and input[type="hidden"] according to documentation (and a useful example)

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