js 获取dom的class
js 获取节点的class
方式一:使用getAttribute
var x = document.getElementsByTagName("H1")[0].getAttribute("class");
方式二:
let oneSwipe=childrenSwipeOptions[i]; let className=oneSwipe.className;
参考:http://www.w3schools.com/jsref/met_element_getattribute.asp
http://www.w3schools.com/jsref/prop_html_classname.asp
相关推荐
Dullonjiang 2020-08-15
程松 2020-06-03
SoShellon 2013-06-01
yawei 2019-12-31
jackalwb 2013-08-20
pythonxuexi 2011-08-13
xhao 2019-11-06
zgwyfz 2019-11-04
zhangpan 2019-10-30
visionzheng 2018-02-09
kick 2011-11-05