Can jQuery get all CSS styles associated with an element?

前端 未结 5 1158
谎友^
谎友^ 2020-11-21 06:31

Is there a way in jQuery to get all CSS from an existing element and apply it to another without listing them all?

I know it would work if they were a style attribut

5条回答
  •  -上瘾入骨i
    2020-11-21 06:52

    Why not use .style of the DOM element? It's an object which contains members such as width and backgroundColor.

提交回复
热议问题