I need to find an element based on a specific css
attribute. The css
is applied inline and I can not use a class. Is there anyway to achieve this in jQuery
?
click(function(){ if($(this). css("background-color") == "#FFFFFF") { $(this). css("background-color", "#C2DAEF"); } });
CSS can be added to HTML documents in 3 ways: Inline - by using the style attribute inside HTML elements. Internal - by using a <style> element in the <head> section. External - by using a <link> element to link to an external CSS file.
jQuery css() Method The css() method sets or returns one or more style properties for the selected elements. When used to return properties: This method returns the specified CSS property value of the FIRST matched element.
jQuery css() Method The css() method sets or returns one or more style properties for the selected elements.
You could use an attribute selector
For example
$(":radio [style*='regular']")
would return a wrapped set of any input radios that contain 'regular'
in the style attribute
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