OTUser
OTUser

Reputation: 3848

jQuery How to remove specific hidden fields

Am trying to remove all input hidden fields which doesnt belong to class="MultiFiles" using jQuery

Below are my sample hidden input fields

<input value="I48rVUwTtrjk" name="UNIQUE_TOKEN" type="hidden">
<input value="151" name="context" type="hidden">
<input type="hidden"  name="isMultiOperation" value="true">
<input type="hidden" class="MultiFiles" name="instance_submittedFile.name" value="">
<input type="hidden" class="MultiFiles" name="instance_submittedFile.fileData.id" value="">

Can someone help me with this?

Upvotes: 0

Views: 4190

Answers (4)

Faucheuse
Faucheuse

Reputation: 11

$('input[type=hidden]:not(.MultiFiles)').remove();

Upvotes: 1

Pixel
Pixel

Reputation: 1976

You can use this :

$('input[type=hidden]').not('.MultiFiles').remove();

.not() Jquery

Upvotes: 6

R4nc1d
R4nc1d

Reputation: 3113

You can try this

$("input[class!='MultiFiles']").remove();

Upvotes: -1

leopik
leopik

Reputation: 2351

Use $("#container input[type='hidden']:not(.MultiFiles)").remove();

Upvotes: 1

Related Questions