How can this be fixed? 'To start playing'

$(document).ready(function(){ //Скрыть PopUp при загрузке страницы PopUpHide(); }); //Функция отображения PopUp function PopUpShow(){ $("#popup").show(); } //Функция скрытия PopUp function PopUpHide(){ $("#popup").hide(); } 
 <button class="play" type="submit" onsubmit="javascript:PopUpShow();">Начать играть</button> 

 $(document).ready(function(){ //Скрыть PopUp при загрузке страницы PopUpHide(); }); //Функция отображения PopUp function PopUpShow(){ $("#popup").show(); } //Функция скрытия PopUp function PopUpHide(){ $("#popup").hide(); } 
  • The question is not onclick, and therefore does not work. - Qwertiy
  • It doesn’t work even with onclick) - c0n

3 answers 3

Instead of <button> it’s best to use a regular link <a href="javascript:PopUpShow();">Начать играть</a>

  • It does not work, there are no errors in the console. - c0n

Add your popup id to your button and since you need an onclick event then use it

 <button class="play" id="popup" type="button" onclick="PopUpShow();">Начать играть</button> 

  • one
    first - no, second - yes - Igor
  • The fact that there is onsubmit is my attempt to fix everything) - c0n
  • The result: the button does not work with the identifier and onclick. jquery connected - c0n
  • When you move the window down code, it appears immediately when the page loads. All indications that jquery is not working, but there are no errors in the console - c0n
  • By the way, I noticed that the display works on small screens - c0n

Problem solved. All because of the fact that I stood on the background of the block video, with position: absolute .

Solution: Put a block with a popup z-index to overlap the video.