how can i extract text after hash # in the href part from a tag?

前端 未结 8 1546
情话喂你
情话喂你 2021-02-07 02:22

I have following a tags:

Any tab1 Label
tab2 Label
Any tab3 Label<         


        
8条回答
  •  醉酒成梦
    2021-02-07 02:43

    function tellMyName() {
      alert(this.hash.replace('#',''));
    }
    
    $('a').click(tellMyName);
    

    crazy fiddle

提交回复
热议问题