behzad behzad - 4 days ago 6
jQuery Question

Why jquery not set visiblity to div visible css properties?

I'm new in

jquery
,have a this div into my web page:


<div class="alert alert-success alert-dismissible" id="Message" style="visibility: hidden;" >
<a href="#" class="close" data-dismiss="alert" aria-label="close">&times;</a>
<strong>Success!</strong> Indicates a successful or positive action.
</div>




write this jquery code:


$(".Message").css("visibility", "visible");



but that code can't set visible property to visibility ,what happen?how can i solve that problem?thanks.

Answer

It has to be: $("#Message").css("visibility", "visible");

As you are selecting an element by its ID For $('.Message'), the class name has to be 'Message'

Comments