简体   繁体   中英

Jquery click function not working on IE 11

jQuery(document).ready(function(){
jQuery('#skip').click(function () {
            $('#exampleModal').modal('hide');
        });

});
</script>



<div class="modal" id="exampleModal" tabindex="-1" role="dialog">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <h5 class="modal-title">Modal title</h5>
        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">&times;</span>
        </button>
      </div>
      <div class="modal-body">
        <p>Modal body text goes here.</p>
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-primary">Save changes</button>
        <button type="button" class="btn btn-secondary" ><u id="skip">skip</u></button>
      </div>
    </div>
  </div>
</div>


Solution: when I change the id skip from underline tag to button tag like below <button type="button" class="btn btn-secondary" id="skip" ><u >skip</u></button> it works ! I am trying to understand why the change in id position is working?

Any help ! much appreciated.

just change

$('#exampleModal').modal('hide'); => $('#exampleModal').hide();

jsfiddle : https://jsfiddle.net/mz9os3ep/2/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM