Loony2nz
Loony2nz

Reputation: 4701

jquery select element with multiple attributes

Ok..i'm having a brainfart right now with jquery's selector process (yes, it's quite confusing to start).

I have 2 input elements on the page, of which I want to remove one.

here are my inputs:

<input value="[email protected]" name="Email" type="hidden">

<input value="[email protected]" id="Email" name="Email" type="text">

I have a blur method on #Email that will remove the hidden Email field. Unfortunately, I'm having a hard time targeting it to remove it.

Can someone help relieve my brainfart? I tried using :not, multiple attributes, etc. The hidden field is server generated and I can't stop it from being sent back.

Thoughts?

Upvotes: 10

Views: 16125

Answers (2)

Keith Rousseau
Keith Rousseau

Reputation: 4475

$('input[name=Email][type=hidden]').remove()

Upvotes: 4

BalusC
BalusC

Reputation: 1108642

$('input[type=hidden][name=Email]').remove();

should do. You can learn more about jQuery selectors here.

Upvotes: 16

Related Questions