0
<style>
.foo {
   color: red; <-- how to change this from jquery
}
</style>

How can I change default css from jquery without $() selector? so entire elements contain class will changed?

Benjamin W
  • 2,658
  • 7
  • 26
  • 48

1 Answers1

0

you can use javascript :

<head>
    <link id="style" rel=stylesheet href="large.css">

</head>

function changeStyle(){
        if(window.innerWidth<900){
            document.getElementById("style").setAttribute("href","small.css");

       }else if((window.innerWidth)>900 &&(window.innerWidth)<1200){
         document.getElementById("style").setAttribute("href","medium.css");   
       }
        else 
              document.getElementById("style").setAttribute("href","large.css"); 
    }  
    window.onresize=changeStyle;
   changeStyle();
Hemant
  • 1,961
  • 2
  • 17
  • 27