Answers for "execute js in css"

4

how to link javascript to html and css

# Javascript
<script src="[file_name].js"></script>

# CSS
<link rel = "stylesheet" type="text/css" href = "style.css" />
Posted by: Guest on November-09-2020
0

javascript add css file

var cssFile = document.createElement('link');
    cssFile.rel = 'stylesheet';
    cssFile.href = "styles.css";  // or path for file {themes('/styles/mobile.css')}
    document.head.appendChild(cssFile); // append css to head element
Posted by: Guest on March-25-2021
0

add css style sheet with javascript

<head>

<script>
function myFunction() {
  var x = document.createElement("LINK");
  x.setAttribute("rel", "stylesheet");
  x.setAttribute("type", "text/css");
  x.setAttribute("href", "styles.css");
  document.head.appendChild(x);
}
myFunction()
</script>

</head>
Posted by: Guest on June-12-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language