What's the effect of adding 'return false' to a click event listener?

前端 未结 16 1759
南旧
南旧 2020-11-21 22:59

Many times I\'ve seen links like these in HTML pages:

Click here !
16条回答
  •  抹茶落季
    2020-11-21 23:14

    Retuning false from a JavaScript event usually cancels the "default" behavior - in the case of links, it tells the browser to not follow the link.

提交回复
热议问题