Display confirmation popup with JavaScript upon clicking on a link

前端 未结 4 1914

How do I make one of those hyperlinks where when you click it, it will display a popup asking \"are you sure?\"



        
4条回答
  •  深忆病人
    2021-01-17 16:41

    try to click, I dare you
    

    with the function

    function confirmAction(){
          var confirmed = confirm("Are you sure? This will remove this entry forever.");
          return confirmed;
    }
    

    (you can also return the confirm right away, I separated it for the sake of readability)

    Tested in FF, Chrome and IE

提交回复
热议问题