Convert tags to html entities

后端 未结 7 692
小蘑菇
小蘑菇 2020-12-08 17:16

Is it possible to convert html tags to html entities using javascript/jquery using any way possible such as regex or some other way. If yes, then how?

Exampl

7条回答
  •  一整个雨季
    2020-12-08 17:36

    In JQuery:

    $('
    ').text('This is fun & stuff').html(); // evaluates to "This is fun & stuff"

    http://debuggable.com/posts/encode-html-entities-with-jquery:480f4dd6-13cc-4ce9-8071-4710cbdd56cb

提交回复
热议问题