I just started learning JavaScript and I want to figure out how to make the close button close the div .popup1
in the following code:
https://jsfiddle.net/74hmx0vb/1
<div class='popup1' id="popup1">
<div class="container">
<div class="row rowpopup">
<div class="iconpopup">
<img class="imgpopup" src="" />
</div>
<div class="textpopup">
<div class="textpopup1">
</div>
<div class="textpopup2">
</div>
</div>
<button type="button" class="close" aria-label="Close">
<span aria-hidden="true"gt;×</span>
</button>
</div>
</div>
</div>
My plan is to make the close button trigger a function upon clicking to add a class with display: none
. Would that be the best approach? I also want to include a fadeout transition when the close button is clicked.
Can anyone provide guidance on how to achieve this? Are there any alternate solutions I should consider?