How to extract text from Link in Javascript?

后端 未结 4 466
鱼传尺愫
鱼传尺愫 2021-01-27 14:08

I have following string:

StackOverFlow

How can I extract text (i.e. StackOver

4条回答
  •  悲哀的现实
    2021-01-27 14:56

    document.getElementById('link_id').innerHTML;
    

    That was my solution before, user added more description but this is solution for current description

    var s = 'StackOverFlow';
    var text = s.match(/]+>(.+)[\<]\/a>/)[1];
    

提交回复
热议问题