JavaScript alert with 3 buttons

后端 未结 4 1211
你的背包
你的背包 2021-01-04 05:41

I have a JavaScript alert button that appears on the website when a user is going to proceed to a signup page.

It looks something like this

Would you like

4条回答
  •  礼貌的吻别
    2021-01-04 06:30

    Nowdays, you can use an HTML dialog element.

    
      

    Greetings, one and all!

    And do what you want with it.

    document.querySelectorAll('button').forEach($button => 
      $button.onclick = () => document.querySelector('dialog').removeAttribute('open'))
    

    https://jsfiddle.net/6nus2zt4/1/

    Hope this help to future generations :)

提交回复
热议问题