How to prevent reload with onclick without “#”?

前端 未结 7 2210
囚心锁ツ
囚心锁ツ 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:16

    Almost any element suports onclick events, so you can use a b tag, or a button tag, even an span tag. Then you can style it to look just like a link (a tag), or any other way you want. For example:

    
    

提交回复
热议问题