How to prevent reload with onclick without “#”?

前端 未结 7 2206
囚心锁ツ
囚心锁ツ 2020-12-14 09:10

I wish to put some instructions with a link - onclick calling a script that display a simple alert box. If I did like this...

7条回答
  •  粉色の甜心
    2020-12-14 09:18

    Return false after the call:

    tipos permitidos
    

    Or if your function returns false then you can return the result of the function:

    tipos permitidos
    

    It's not enough to just return false in the function, you need to actually return false from the click handler.

提交回复
热议问题