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?
Multiple Attribute [attr="value"][attrn="valuen"] Examples Selectors << Top. Selects all elements that match all of the specified attribute and value filters.
that's because when you call the data method on the jQuery object, it returns the data for the first element in the nodeList. To get the data for all the div's you have to loop through the elements with the $. each method or use a mapping to retrieve the attributes in a list. Show activity on this post.
You can specify any number of selectors to combine into a single result. This multiple expression combinator is an efficient way to select disparate elements. The order of the DOM elements in the returned jQuery object may not be identical, as they will be in document order.
The :contains() selector selects elements containing the specified string. The string can be contained directly in the element as text, or in a child element. This is mostly used together with another selector to select the elements containing the text in a group (like in the example above).
$('input[type=hidden][name=Email]').remove();
should do. You can learn more about jQuery selectors here.
$('input[name=Email][type=hidden]').remove()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With