Oleksandr IY
Oleksandr IY

Reputation: 3116

select all elements of the form but need exclude some elements with jquery

I try to pass form variables so I do

$("#form1").serializeArray();

but I do not need to select some elements so I need something like that

$("#form1 not .someclass").serializeArray();

How to do that

Upvotes: 0

Views: 58

Answers (3)

Arun P Johny
Arun P Johny

Reputation: 388316

To select all all input,select,textarea fields excluding .someclass elements

$("#form1 :input:not(.someclass)").serializeArray();

Demo: Fiddle

Upvotes: 1

Greenhorn
Greenhorn

Reputation: 1700

$("#form").not(".someClass").serializeArray();

Upvotes: 2

Anton
Anton

Reputation: 32581

Use :not()

$('#form1 :not(".someclass")');

Upvotes: 2

Related Questions