How to implement the display of a modal window by clicking on one element and hiding on clicking on another with the help of toggleClass ?

My code below only works in half, i.e. adding the class .md-show works, but deleting by .md-close does not work. Is it possible that the layout of the buttons affects the DOM?

PS: .md-close is inside the block from which you want to remove the class.

 $(".md-close, .md-trigger").click(function(){ $(".modal").toggleClass("md-show"); }); 
  • show your html, the usual layout of the buttons does not matter, for example - Alex
  • the code looks working. Just note that $(".modal") selects all elements with the modal class. On the page - Grundy
  • he is one on the page. The main thing - Identical code for another element works fine! - malginovdesign

0