Answer the question
In order to leave comments, you need to log in
How to make multiple modal windows?
There is such a design
<script>
$(document).ready(function(){
PopUpHide();
});
function PopUpShow(){
$("#popup").show();
}
function PopUpHide(){
$("#popup").hide();
}
</script>
<div id="popup" name="Users">
</div>
<div id="popup" name="Groups">
</div>
<a class="del" href="javascript:PopUpHide()" onclick="fync();" title="Close users">X</a>
<a class="del" href="javascript:PopUpHide()" onclick="fync();" title="Close groups">X</a>
Answer the question
In order to leave comments, you need to log in
$(document).ready(function(){
PopUpHide('popup1');
});
function PopUpShow(id){
$(`#${id}`).show();
}
function PopUpHide(id){
$(`#${id}`).hide();
}
<div id="popup1" name="Users">
</div>
<div id="popup2" name="Groups">
</div>
Modals should open by class. You can't have more than one element with the same id! This is an id and must be unique. This html will not be valid.
And in the button, you can pass a parameter by which it will determine which window it should open. For example, in the data attribute.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question