Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
103
rated 0 times [  106] [ 3]  / answers: 1 / hits: 179198  / 11 Years ago, fri, june 28, 2013, 12:00:00

Here's an example of an alert I'm using:



<div class=alert alert-error id=passwordsNoMatchRegister>
<span>
<p>Looks like the passwords you entered don't match!</p>
</span>
</div>


I know that $(.alert).show() and $(.alert).hide() will show/hide all the elements of the .alert class. However, I cannot figure out how to hide a specific alert, given its id.



I want to avoid using .alert(close), since that permanently removes the alert, and I need to be able to recall it.


More From » jquery

 Answers
10

You need to use an id selector:



 //show
$('#passwordsNoMatchRegister').show();
//hide
$('#passwordsNoMatchRegister').hide();


# is an id selector and passwordsNoMatchRegister is the id of the div.


[#77350] Thursday, June 27, 2013, 11 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
lara

Total Points: 462
Total Questions: 100
Total Answers: 102

Location: Jersey
Member since Mon, Jun 14, 2021
3 Years ago
lara questions
;