下面是我正在使用的警报示例:
<;div class=“警报错误”id=“密码匹配寄存器”>;
<;span>;
<;p>;看起来你输入的密码不匹配</p>;
</span>;
</部门>;
我知道$(“.alert”).show()和
$(“.alert”).hide()将显示/隐藏
.alert
类的所有元素。但是,鉴于特定警报的id,我无法确定如何隐藏该警报
我希望避免使用.alert(“close”)
,因为这样会永久删除警报,并且我需要能够调用它
您需要使用id选择器:
//显示
$('#passwordsNoMatchRegister').show();
//隐藏
$('#passwordsNoMatchRegister').hide();
#
是一个id选择器,密码匹配寄存器
是div的id