<table class="prtlPageConR" style="width: 100%;" cellSpacing="0" cellPadding="0">
试图删除style =“width:100%;”使用:如何使用jQuery删除内联样式
$(".prtlPageConR table").css({"width":"0px");
但它不起作用。
想法?
<table class="prtlPageConR" style="width: 100%;" cellSpacing="0" cellPadding="0">
试图删除style =“width:100%;”使用:如何使用jQuery删除内联样式
$(".prtlPageConR table").css({"width":"0px");
但它不起作用。
想法?
你的选择不正确,你正在寻找一个table
孩子.prtlPageConR
,不一个table
元素与.prtlPageConR
一个class
。
要删除style
共有属性,你可以简单地使用jQuery's removeAttr()
method:
$("table.prtlPageConR").removeAttr("style");
的问题是CSS的错误认识。
.prtlPageConR table
手段“搜索包含的元素与prtlPageConR
类table
”
你想要的是table.prtlPageConR
这意味着“搜索具有类prtlPageConR
表”
如果你只是设置样式转换为空字符串,它将重置该单个样式。 其他答案已经解释过,您的选择器也存在一些问题。
$("table.prtlPageConR").css({"width":""});
缺少'}'的对象字面值? – undefined