下面是我使用的警报的例子:如何使用twitter bootstrap显示/隐藏特定警报?
<div class="alert alert-error" id="passwordsNoMatchRegister">
<span>
<p>Looks like the passwords you entered don't match!</p>
</span>
</div>
我知道$(".alert").show()
和$(".alert").hide()
将显示/隐藏.alert
类的所有元素。但是,我无法弄清楚如何隐藏特定的警报,因为它的ID。
我想避免使用.alert("close")
,因为它会永久删除警报,我需要能够回忆它。
任何CSS选择器的jQuery函数'$()'会发现匹配该选择器的元素。 'div','.class_name','#elem'等。它甚至会做特殊的选择器,如属性选择器'[id =“id_name”]'或'*'。只要把它看作是一个CSS选择器,你应该觉得它更有创意。 –
你能提供'小提琴'来重现你的问题吗? – muneebShabbir
我在下面评论;我拼写错了''在我的标题中(这就是为什么jQuery没有任何工作)。 – royhowie