“[removed]void(0);” vs “return false” vs “preventDefault()”

前端 未结 8 1276
滥情空心
滥情空心 2020-11-28 19:44

When I want some link to not do anything but only respond to javascript actions what\'s the best way to avoid the link scrolling to the top edge of the page ?
I know sev

8条回答
  •  攒了一身酷
    2020-11-28 20:02

    Dreamweaver uses a nice little trick by default that I've started using.

    
    

    It's small, it doesn't trip and anchors and it's library agnostic.

提交回复
热议问题