我想,我怎样才能从单击事件如何使用jQuery获取类或id上的所有属性?
意味着class和id的所有属性,假设我有class和id:上单击事件
.sample {
margin: 10px;
color: #000;
padding: 5px;
border: 1px solid #4073ff;
}
#test {
background: url(../sample.jpg) 20px 20px no-repeat cover red;
}
现在我希望所有的
类属性打印这样
<div id="cProperties">
<h6>All properties from class comes here</h6>
margin = 10px
color = #000
padding = 5px
font-size = 60px
border size = 1px
border style = solid
border color = #4073ff
</div>
和id属性打印这样
<div id="iProperties">
<h6>All properties from id comes here</h6>
background url = url(../sample.jpg)
top = 20px
center = 20px
repeteation = no-repeat
attachment = cover
color = red
</div>
你想从一个网页,或CSS文件的属性? – wazz
@wazz网页和css文件 – user7791702