how to set multiple CSS style properties in typescript for an element?

前端 未结 4 1674
有刺的猬
有刺的猬 2021-02-12 20:09

Please consider the below snippet. i need to set multiple CSS properties in typescript. for that i have tried the below code.

public static setStyleAttribute(ele         


        
4条回答
  •  逝去的感伤
    2021-02-12 20:57

    Try using setAttribute. TypeScript does not have the style property on Element.

    element.setAttribute("style", "color:red; border: 1px solid blue;");
    

    Some related discussion in this GitHub issue: https://github.com/Microsoft/TypeScript/issues/3263

提交回复
热议问题