我试图找出使用没有表单的jquery动态关闭模态框

5 javascript jquery

我试图使用没有表单的jQuery动态地找出一个模态框.

 <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>
Run Code Online (Sandbox Code Playgroud)

小智 3

尝试下面的代码它会对你有帮助

 $('#openModal').modal('hide');
 $('#openModal').modal().hide();
 $('#openModal').removeClass('show');
Run Code Online (Sandbox Code Playgroud)