<a> 标签在展开时会破坏样式
<a> tag breaks style when unwrapped
我又来了,我有这个脚本,所以当另一个 html 页面上的按钮 "quadrant_1" 被点击时,它会改变第一个 html 页面上的按钮颜色,但是另外 我希望它禁用 a href link,因为我有这个:
var noLink = $('a')
if(localStorage.getItem('quadrant_1', ) === 'clicked'){
$("#btn-institucional").css({backgroundColor: "#d8d8d6"});
$("#btn-institucional").unwrap({noLink});
}
要删除标签,但问题是当标签被删除时,它会破坏所有的行和按钮样式
before tag is removed
After Tag was removed
这是按钮之一 html
<div class="number button col-lg-3 col-md-3 col-sm-12 col-xs-12" style="color:#ffffff; background-color:#003E8B; cursor: pointer; color: #ffffff;" id="btn-institucional">
<a href="gobierno.html" >
<p>1</p>
<img src="icons/institucional.png" width= "50%">
<p>Desarrollo Institucional para un Buen Gobierno</p>
</a></div>
非常感谢您的帮助,我真的不知道为什么如果我在外面有 div 和 bootstrap class 列。
我猜样式中断是因为您试图 unwrap('a')
删除 <div>
.
您可以尝试这样的操作:
if(localStorage.getItem('quadrant_1', ) === 'clicked'){
$("#btn-institucional").css({backgroundColor: "#d8d8d6"});
$("#btn-institucional p").unwrap();
}
我又来了,我有这个脚本,所以当另一个 html 页面上的按钮 "quadrant_1" 被点击时,它会改变第一个 html 页面上的按钮颜色,但是另外 我希望它禁用 a href link,因为我有这个:
var noLink = $('a')
if(localStorage.getItem('quadrant_1', ) === 'clicked'){
$("#btn-institucional").css({backgroundColor: "#d8d8d6"});
$("#btn-institucional").unwrap({noLink});
}
要删除标签,但问题是当标签被删除时,它会破坏所有的行和按钮样式
before tag is removed
After Tag was removed
这是按钮之一 html
<div class="number button col-lg-3 col-md-3 col-sm-12 col-xs-12" style="color:#ffffff; background-color:#003E8B; cursor: pointer; color: #ffffff;" id="btn-institucional">
<a href="gobierno.html" >
<p>1</p>
<img src="icons/institucional.png" width= "50%">
<p>Desarrollo Institucional para un Buen Gobierno</p>
</a></div>
非常感谢您的帮助,我真的不知道为什么如果我在外面有 div 和 bootstrap class 列。
我猜样式中断是因为您试图 unwrap('a')
删除 <div>
.
您可以尝试这样的操作:
if(localStorage.getItem('quadrant_1', ) === 'clicked'){
$("#btn-institucional").css({backgroundColor: "#d8d8d6"});
$("#btn-institucional p").unwrap();
}