how do you strip html tags in textarea input

后端 未结 6 1675
自闭症患者
自闭症患者 2020-12-16 21:00

I have set up a little web application where you add post-its to a page. It\'s just a project to help better learn JavaScript/jQuery and it seemed like an appropriate projec

6条回答
  •  一个人的身影
    2020-12-16 21:44

    function stripHTML(text){
       var regex = /(<([^>]+)>)/ig;
       return text.replace(regex, "");
    }
    // USE: var str = stripHTML('test');
    

    Demo: http://jsfiddle.net/pisabev/eJzfw/3/

提交回复
热议问题