Adding click event via addEventListener to confirm navigation from a hyperlink

前端 未结 3 960
盖世英雄少女心
盖世英雄少女心 2020-12-28 08:55

I am writing some JavaScript that what I essentially want to do is confirm when a user clicks a link that they do actually want to click it.

My code currently looks

3条回答
  •  长发绾君心
    2020-12-28 09:53

    You have to prevent the execution of the default event handler.

    See How to use Javascript's addEventListener() to override an HTML Form's default submit() behavior

    --EDIT--

    We'll, I've seen you've answered yourself while I was editing the answer

提交回复
热议问题