How do I add style to content in JavaScript?

后端 未结 4 1824
独厮守ぢ
独厮守ぢ 2021-01-13 08:02

I have been working in a JavaScript file and my content has been working with phrases. Now I want to change the style of those phrases. The first function (see function swap

4条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-01-13 08:38

    obj.style.whicheverProperty = "value"
    

    for instance:

    document.getElementById('mydiv').style.fontVariant = "italic";
    

    The google keyword you're looking for is HTML DOM (document object model), which defines the various styles as properties of an object's style member.

提交回复
热议问题