Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

link stylesheet in javascript

var cssId = 'myCss';  // you could encode the css path itself to generate id..
if (!document.getElementById(cssId))
{
    var head  = document.getElementsByTagName('head')[0];
    var link  = document.createElement('link');
    link.id   = cssId;
    link.rel  = 'stylesheet';
    link.type = 'text/css';
    link.href = 'http://website.com/css/stylesheet.css';
    link.media = 'all';
    head.appendChild(link);
}
Comment

PREVIOUS NEXT
Code Example
Javascript :: react native get uri of the image in the app assets folder 
Javascript :: get last two digits of year javascript 
Javascript :: nodejs how to send html 
Javascript :: readfile nodejs 
Javascript :: browserslisterror contains both .browserslistrc and package.json with browsers 
Javascript :: stripe react js 
Javascript :: mongodb $in regex 
Javascript :: javascript if shorthand 
Javascript :: toast in angular not working 
Javascript :: store data to the browser’s localStorage 
Javascript :: javascript group by key 
Javascript :: javascript array 
Javascript :: javascript get element by rel attribute 
Javascript :: df.saveto json 
Javascript :: cannot use import statement outside a module 
Javascript :: javascript how to reverse a string 
Javascript :: javascript format date 
Javascript :: if classlist contains js 
Javascript :: how to run function after animation complete jquery 
Javascript :: finding an element ina na array in js 
Javascript :: javascript new date dd/mm/yyyy 
Javascript :: how to filter out undefined keys from object in js 
Javascript :: javascript get srollwidth 
Javascript :: dynamic loop variable .each create hash javascript 
Javascript :: react native backgrunde img 
Javascript :: docker daemon bind to host and port 
Javascript :: pushing element in array in javascript 
Javascript :: find highest and lowest number string javascript 
Javascript :: fetch function javascript 
Javascript :: copy object array javascript 
ADD CONTENT
Topic
Content
Source link
Name
8+3 =