How to dynamically change a class css styling?

前端 未结 4 556
有刺的猬
有刺的猬 2021-01-05 08:59

Goal

In my program I want to do both things with jquery/javascript:

  1. Change styling of css classes dynamically
  2. Add/remove classes to elements
4条回答
  •  梦谈多话
    2021-01-05 09:12

    @synthet1c has described the problem. My solution is:

    $("head").append('');
    var element = $("head").children(':last');
    element.html('.redclass{color: darkred;}');
    

提交回复
热议问题