How to dynamically change the value of a CSS property inside a stylesheet?

前端 未结 2 730
走了就别回头了
走了就别回头了 2021-01-06 17:57

If I have css:

.myclass
{
background: #FF00FF;
}

And html:

etc.
2条回答
  •  再見小時候
    2021-01-06 18:20

    Hope I am close to what you are expecting when I say You may please try something like this:-

    $(document).ready(function(){
        $("button").click(function(){
            $("div").toggleClass("myclass");
        });
    });
    .myclass
        {
           background: #FF00FF;
        }
    
    
    
    
    
    
    
    
    
    
    
    etc.
    etc.
    etc.

提交回复
热议问题