I need to select elements in jquery, attibute values of which do not end with a specified substring.
It must be an equivalent to "match all elements but those that end with a given substring in that attribute".
So that e[a!@#=finstr]
matches e, e a="finstring"
etc, and does NOT match e a="somethingfinstr"
, e a="finstr"
.
Help, thanks.
The jQuery #id selector uses the id attribute of an HTML tag to find the specific element. An id should be unique within a page, so you should use the #id selector when you want to find a single, unique element.
attributeStartsWith selector Description: Selects elements that have the specified attribute with a value beginning exactly with a given string.
The [attribute|="value"] selector is used to select elements with the specified attribute, whose value can be exactly the specified value, or the specified value followed by a hyphen (-). Note: The value has to be a whole word, either alone, like class="top", or followed by a hyphen( - ), like class="top-text".
Something along the lines of
$(':not([name$="finstr"])')
Should do the trick!
Edit: alternatively
$(selector).not('[name$="value"]');
I think this would work, using links as an example -
$("a:not([id$='hello'])"
Demo - http://jsfiddle.net/CJH2M/
Try inverting the: Attribute Ends With Selector [name$="value"]. with jQuery(':not(selector)').
Something like this: :not([name$="value"])
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