I am trying to figure out how to use the same function
(closing a modal when clicking out of the modalbox):
window.onclick = function(event) {
if (event.target == modalEth) {
modalEth.style.display = "none";
}
and
window.onclick = function(event) {
if (event.target == modalBtc) {
modalBtc.style.display = "none";
}
within to different modals.
Right now, only the onclick funktion "modalBtc" works the way it should.
I don't have a clue how to bring the first function "modalEth" to life.
It would be great if someone could help me out with a solution.
HTML (1. ModalEth, 2. ModalBtc)
<div id="myModalEth" class="modalEth">
<div class="modal-contentEth">
<p>some content</p>
</div>
</div>
<div id="myModalBtc" class="modalBtc">
<div class="modal-contentBtc">
<p>some content</p>
</div>
</div>