I want to select all HTML <span>
elements that don't have an id
equal to x
and hide them them. Is this possible? I think you have to use the :not
selector but I can't work it out:
$('span:not(#x').attr('style', "display: none;");
Any ideas? Thank you :).
You just forgot a ).
I made a fiddle to show you. http://jsfiddle.net/3U8tD/
$('span:not(#x)').attr('style', "display: none;");
$('span[ID!="x"]').attr('style', "display: none;");
sets the style attribute of all spans, wich has NOT the id x, to none.
hope this helps
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