Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

data-dismiss= modal in jquery

$(document).ready(function(){
        // Open modal on page load
        $("#myModal").modal('show');
 
        // Close modal on button click
        $(".btn").click(function(){
            $("#myModal").modal('hide');
        });
    });
Comment

modal dismiss

<!-- Button trigger modal -->
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#exampleModalCenter">
  Launch demo modal
</button>

<!-- Modal -->
<div class="modal fade" id="exampleModalCenter" tabindex="-1" role="dialog" aria-labelledby="exampleModalCenterTitle" aria-hidden="true">
  <div class="modal-dialog modal-dialog-centered" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <h5 class="modal-title" id="exampleModalLongTitle">Modal title</h5>
        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">×</span>
        </button>
      </div>
      <div class="modal-body">
        ...
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
        <button type="button" class="btn btn-primary">Save changes</button>
      </div>
    </div>
  </div>
</div>
Comment

data-dismiss="modal" in js

$('.close').click();
Comment

PREVIOUS NEXT
Code Example
Javascript :: document.queryselector null check 
Javascript :: onfocus js 
Javascript :: js copy image to clipboard 
Javascript :: nodejs update in mysql 
Javascript :: js mouse move activate 
Javascript :: json server paging 
Javascript :: nodejs download file 
Javascript :: Scroll elementleft using js 
Javascript :: javascript find object array 
Javascript :: use these instead of a for loop javascript 
Javascript :: jquery load 
Javascript :: password meter 
Javascript :: delete space from string javascript 
Javascript :: find unique value on array 
Javascript :: same click event in multiple elements in on event 
Javascript :: queryselectorall in jquery 
Javascript :: auto refresh page javascript 
Javascript :: get console javascript 
Javascript :: js months ago 
Javascript :: Dart regex all matches 
Javascript :: node-fetch 
Javascript :: extend javascript 
Javascript :: video mute and unmute 
Javascript :: select2 multi select get selected value 
Javascript :: how to make unclicable legend chartjs 
Javascript :: chai test throw error 
Javascript :: componentwillreceiveprops hooks 
Javascript :: escaped json to json javascript 
Javascript :: loop through json array python 
Javascript :: execute command method 
ADD CONTENT
Topic
Content
Source link
Name
3+3 =