Click here to Skip to main content
15,904,416 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How to hide and show Modal Popup in javascript.


my modal panel id is Modal panel
Posted
Updated 8-Jun-14 23:51pm
v2

HTML
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
 <script>
     function ShowPopup() {

         $("#DivPopup").show();
         //or
         $("#DivPopup").fadeIn();

     }

     function HidePopup() {

         $("#DivPopup").hide();
         //or
         $("#DivPopup").fadeOut();

     }
 </script>



CSS
#DivPopup
     {
         position: fixed;
         top: 50%;
         left: 50%;
         height: 240px;
         width: 240px;
         margin-left:-120px;
         margin-top:-120px;
         background-color:Red;
         border:1px solid black;
         border-radius:10px;
        display:none;
     }


HTML
<div id="DivPopup">
</div>
<span  önclick="ShowPopup()">Show</span> <span  önclick="HidePopup()">Hide</span>
 
Share this answer
 
v2
Comments
Member 10869970 9-Jun-14 8:09am    
i placed my modal popup in ur custom div its working
Nirav Prabtani 9-Jun-14 8:15am    
yupp .. :)
See a solution in www.jsfiddle.com )))

http://jsfiddle.net/chrisjaure/KzpLk/
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900