Kung Fu Ninja
Kung Fu Ninja

Reputation: 3752

resetting form fields except one

I am trying to reset all the form fields except one.

$(':input','#myForm').not(':button, :submit, :reset, :hidden, input[ignoreField]').val('').removeAttr('checked').removeAttr('selected');

How can I exclude inputs with "ignoreField" class?

thanks in advance

Upvotes: 5

Views: 6279

Answers (2)

S.Visser
S.Visser

Reputation: 4725

$(':input','#myForm').not('.ignoreField').val('').removeAttr('checked').removeAttr('selected');

Upvotes: 1

Adil Shaikh
Adil Shaikh

Reputation: 44740

You can use - input[class=ignoreField]

$(':input','#myForm').not(':button, :submit, :reset, :hidden, input[class=ignoreField]')

Upvotes: 3

Related Questions