我有2个vars,需要将b插入到evry“}”之后,并且需要任何css类。我怎么能用jquery或javascript做到这一点?
var a = "p{font-size:20px}
.tihais {font-weight:bold}";
var b = "#afnay";
var position = after evry "}";
THX
答案 0 :(得分:1)
var a = "p{font-size:20px}
.tihais {font-weight:bold}";
var b = "}#afnay"; // This variable value is changed!
a= a.replace("}", b);
答案 1 :(得分:0)
var a = 'p{font-size:20px}\n'+
'.tihais {font-weight:bold}';
var b = "}#afnay";
a= a.replace(/}/g, b);
console.log(a)