jQuery this.hash behavior for in page anchor links

前端 未结 3 2002
自闭症患者
自闭症患者 2021-02-13 13:38

I have a question about how this.hash works for in page anchor links in jQuery.

I need to process the hash attribute every time the user clicks on that link.



        
3条回答
  •  滥情空心
    2021-02-13 14:02

    Why can't we use attr('href') - check this link

    http://jsfiddle.net/BQU3u/11/

    Update

    Simply remove $ from $(this.hash)

    http://jsfiddle.net/BQU3u/12/

提交回复
热议问题