JQuery 隐藏和显示指定标签

原始代码

<style>
   .step2_class  {
  width: 1200px;
  margin: 0 auto;
  padding-top: 245px;
}
</style>

<div align="center" id="step2ID" class="step2_class">
<label class="step2Class" style="color:Red;font-size:30px;" id="step2Label">人工审核中,请等待1-2天</label>
</div>

隐藏标签

根据id隐藏某个标签(不占位隐藏)

$("#step2ID").attr("style", "display:none;");

根据class隐藏某个标签(不占位隐藏)

$(".step2_class").attr("style", 'display:none;');

运行效果

2364940-a847a5a52e72fe7e.png
image.png

显示标签

根据id显示某个标签(清空了style属性里面所有的值,自然设定的"display:none;"也被清空了)

$("#step2ID").attr("style", '');

根据class显示某个标签

$(".step2_class").attr("style", '');

运行效果

2364940-3787e176d4bc5c0b.png
image.png

猜你喜欢

转载自blog.csdn.net/weixin_34390996/article/details/87069621