Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JQuery selector for inline style property

Tags:

jquery

asp.net

I would like to use a jquery to select the following span:

<span id="RequiredFieldValidator1" class="validationerror" style="color: Red; display: none;">*</span>

But not select the following span which differs from the original in that the style attribute has a display property whose value is inline instead of none.

<span id="RequiredFieldValidator2" class="validationerror" style="color: Red; display: inline;">*</span>

I am aware inline styles are evil but an asp.net web forms validator control is generating it and doing a lot of good as well as evil.

Can this be done using jquery selectors? I'm new to jquery.

like image 608
Craig McKeachie Avatar asked Aug 25 '26 12:08

Craig McKeachie


2 Answers

$("span[style*=inline]")

will select all span elements with the style attribute which has the value "inline" in it somewhere.

like image 104
aleemb Avatar answered Aug 28 '26 05:08

aleemb


Try something like this:

$('.validationerror:hidden')
like image 45
bendewey Avatar answered Aug 28 '26 04:08

bendewey



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!