jQuery: Change Background-Color of HTML-Element using jQuery
Question by Guest | 2013-12-07 at 20:59
I would like to change the background-color of an HTML element with jQuery dynamically.
For example, given the ID of a DIV container, I would like to change the DIVs background to red. Is that possible?
Related Topics
CSS: Colorize Table Rows Alternately only with CSS
Tutorial | 0 Comments
CSS: Why is DarkGray brighter than Gray?
Info | 0 Comments
Color Values: Convert RGB, CMYK, CMY, HSV, TColor and XYZ Values
Tutorial | 0 Comments
Darken Background of a Website (Gray Out Effect)
Tutorial | 0 Comments
Pipette: Fetch Colors from all over the Screen
Tutorial | 0 Comments
CSS: Include CSS Stylesheets in HTML
Tutorial | 0 Comments
Important Note
Please note: The contributions published on askingbox.com are contributions of users and should not substitute professional advice. They are not verified by independents and do not necessarily reflect the opinion of askingbox.com. Learn more.
Participate
Ask your own question or write your own article on askingbox.com. That’s how it’s done.
That should not be a problem with jQuery. You can use the following way:
Where the element could be like this:
With "#myid", you can address the ID of the element (in this case "myid") and with .css() you can change arbitrary CSS-properties of this element (in this case the property "background-color").
2013-12-07 at 21:21