【发布时间】:2017-09-25 18:48:53
【问题描述】:
我有一个动态创建的标签元素。当我创建它时,我给它一个值为“none”的数据滚动属性,并试图用我自己的具有“!important”值的类来覆盖它。不幸的是,保证金仍在执行中。
这是控制台的图像:https://gyazo.com/26566879cb903304a24b3b313a777c75
CSS:
#label {
margin: 0px !important;
}
JS:
$("<label />") //create new label
.attr("id", "label" + listCount) //set ID
.attr("for", "input" + listCount) //set For
.attr("class", "inline")
.attr("data-roll", "none")
.html(input) //set contents
.appendTo("#input" + listCount + "container");//add to checkbox container
【问题讨论】:
标签: javascript jquery css jquery-mobile