top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

How to write css in Javascript ?

+1 vote
367 views

Am new to JavaScript?Any one please give some sample code for this.

posted Jul 14, 2014 by anonymous

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

The simple-and-direct approach is to create and add a new style node to the document.

var css = document.createElement("style");
css.type = "text/css";
css.innerHTML = "strong { color: red }";
document.body.appendChild(css);
answer Aug 7, 2014 by Manish Tiwari
Similar Questions
0 votes

I want to add a menu to my application screens. The menu will have the menu icons which are horizontal scroll-able one menu at a time when left or right arrow pressed.

...