Onclick to close a modal without reload

1

This button closes a modal, but must be done without causing a reload. How is it?

<button type="button" class="close" data-dismiss="modal" aria-label="Close" onclick="javascript:window.location.reload()"><span aria-hidden="true">×</span>
    </button> 
    
asked by anonymous 11.09.2018 / 16:47

1 answer

0

The problem is that on your button:

<button type="button" class="close" data-dismiss="modal" aria-label="Close" onclick="javascript:window.location.reload()"><span aria-hidden="true">×</span></button> 

the code:

onclick="javascript:window.location.reload()"

causes the page to be reloaded, you can either take that onclick event or put it back to void.

<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> 

onclick="javascript:void(0)"
    
11.09.2018 / 18:00