Add/Modify CSS in a – Slavenko Miljic Jun 03 '15 at 18:25

0

you can do it using j-query the following way

$("#button_background").css("color",'blue')
bhanu.cs
  • 1,345
  • 1
  • 11
  • 25
0

While you can do that there is easier ways to do (check here and here), for example: using the class selector you can filter all objects that have the "old" class $( ".oldClass" ) and manipulate what classes they have (instead editing the class) :

filter and add the new class

$( ".oldClass" ).addClass(".newClass")

and remove the old class

$( ".oldClass" ).removeClass(".oldClass")

you can also use .css to change a property :

$( ".oldClass" ).css("background","#ff0000")

Community
  • 1
  • 1
Rod
  • 754
  • 11
  • 21
  • I can't change classes as we are building DATA attributes based off these classes and other integrated. Those links provided are interesting thanks. – DigitalMC Jun 03 '15 at 18:20
  • @DigitalMC technically .css() won't change the class itself, but will add a overriding property to all elements that have the specified class, so it will produce the same result as editing the class. – Rod Jun 03 '15 at 18:23
  • True, but it gets deeper as we have "sub-color schemes" that can overwrite the default template theme for certain pieces of content. This makes the Cascading feature of CSS super nice while adding/removing inline styles will get very arduous. – DigitalMC Jun 03 '15 at 18:39
  • Thanks so much for your contribution. – DigitalMC Jun 03 '15 at 18:45
  • @DigitalMC essentially if you add a class that has a selector level equal to or greater than, this should be a good contribution, since directly modifying the css style tag will get convoluted. – Daemedeor Jun 03 '15 at 19:30