javascript - Ripping off HTML tags and considering line breaks in a textarea
I am using CodeIgniter for my own web page and I have several textareas in it. Is there any way that I can prevent HTML tags to be stored in the database? Is there any utility that takes the text out clean?
Also, I do want to display line breaks, so when anyone types anything in the textarea and presses enter, it should produce a line break when displayed later. Should I store the<br>
in the database?
I don't know if this can be done with CodeIgniter or any php function or javascript and/or jQuery has to be used, and how to do it.
Answer
Solution:
Make use of for this... with an allowable tag
<br>
selected.Answer
Solution:
Use the php function strip tags: http://www.php.net/strip_tags