Do not support HTML in textarea

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Gabriella

    Do not support HTML in textarea

    Hi,
    I have a textarea and I would like to prevent users from inserting
    HTML tags. Only plain text is supported.
    Which client-side js regular expression is best for this?
    Thanks, Gabi

  • David Dorward

    #2
    Re: Do not support HTML in textarea

    On Oct 24, 11:59 am, Gabriella <frohlin...@yah oo.comwrote:
    I have a textarea and I would like to prevent users from
    inserting HTML tags. Only plain text is supported.
    Which client-side js regular expression is best for this?
    None. Client side JS can't prevent them from entering anything.

    And are you certain they won't want to insert things that look like
    tags but are actually text?

    Just do the usual replacement of &->&amp;, >->&gt;, <->&lt; server
    side and HTML injection will be defeated.

    --
    David Dorward
    David Dorward's mostly neglected blog

    David Dorward's mostly neglected blog




    Comment

    Working...