jQuery remove tag from HTML String without RegEx

前端 未结 6 1701
情话喂你
情话喂你 2020-12-05 14:25

So I have following string:

var s = \'Some Text Some other Text\';

The result should be a string with the content

6条回答
  •  清歌不尽
    2020-12-05 14:40

    A very simple approach:

    var html = 'Remove tags & entities';
    var noTagText = $(html).text();
    // ==> noTagText = 'Remove tags & entities'
    

    Note that it will remove tags but also html entities.

提交回复
热议问题