tags:

views:

50

answers:

2

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 "myform", but I dont know how to exclude buttons and checkbox items. Does anyone know how to do this?

this is what I have so far:

$("#myform :input")

How do I "filter out" buttons and checkboxes on the form?

+1  A: 
$("#myform :input:not(:checkbox):not(:button)");
Marwan Aouida
I *LOVE* jQuery - its so intuitive!
morpheous
Whether [type="submit"] isn't part of the question or [type="image"] should be added?
Felipe Alsacreations
+1  A: 

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

Felipe Alsacreations
You just beat me to it... and a little cleaner too
Calgary Coder