Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

mbpowner

macrumors regular
Original poster
Aug 19, 2016
174
14
how do you change the fill colour of a class/id using javascript? I only found how to background colour with js /jquery which both dont seem to wor...

thanks
 
how do you change the fill colour of a class/id using javascript? I only found how to background colour with js /jquery which both dont seem to wor...

thanks
Many ways... but this is a simple to understand way.

Create two css classes. One is red, the other white.
Switch the class on a button press or programatically, based off of a scroll, click or timed event.

If you post a link to your code in something like JSBin. We could specifically show you were you messing up.
Good luck!
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.