Vinay Sharma Vinay Sharma - 2 months ago 7
jQuery Question

I am trying to figure out closing a Modal Box Dynamically using jquery without a form

I am trying to figure out a Modal Box Dynamically using jQuery without a form.

<a href="#openModal">Open Modal</a>

<div id="openModal" class="modalDialog">
<div> <a href="#close" title="Close" class="close">X</a>

<h2>Modal Box</h2>

<p>This is a sample modal box that can be created using the powers of CSS3.</p>
<p>You could do a lot of things here like have a pop-up ad that shows when your website loads, or create a login/register form for users.</p>
</div>



Answer

Try the below code it will help you

 $('#openModal').modal('hide');
 $('#openModal').modal().hide();
 $('#openModal').removeClass('show');
Comments