Clone style in jQuery?

后端 未结 9 1590
轻奢々
轻奢々 2021-02-05 03:56

I have a called spn1, which has some style from inline + CSS file.

I have another called spn2

9条回答
  •  独厮守ぢ
    2021-02-05 04:40

    If you just want the CSS, you can do the following:

    let cssText = document.defaultView.getComputedStyle( $("#elementID"), "").cssText;
    

    Then you can apply that to any new element.

提交回复
热议问题