how do you strip html tags in textarea input

后端 未结 6 1664
自闭症患者
自闭症患者 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:36

    No one successfully answered this question in accordance with the OP's request, in that the inner tags would be completely removed from the input, not just the tags themselves; so, here's an answer that will do precisely that (Fiddle):

    var input = "This is nota successful test";
    var output = $("
    ").html(input).children().remove().end().text()

提交回复
热议问题