Replace a link with it's text with jQuery

后端 未结 2 391
半阙折子戏
半阙折子戏 2020-12-10 11:27
TEST

I want to remove the anchors and keep the Text i.e TEST

2条回答
  •  星月不相逢
    2020-12-10 12:18

    If you want to remove the link and leave the text:

    $("a").replaceWith(function(){ return $(this).text() });​
    

    Online Demo: http://jsbin.com/aguki/edit

    If you're using jQuery 1.4+, CMS provided an even shorter answer.

提交回复
热议问题