jQuery (almost) equivalent of PHP's strip_tags()

后端 未结 9 836
忘掉有多难
忘掉有多难 2020-11-27 04:50

Is there a jQuery version of this function?

string strip_tags( string $str [, string $allowable_tags ] )

stri

9条回答
  •  野性不改
    2020-11-27 05:15

    Not an actual answer, but a word of caution (depending on what you're trying to do with this):

    IMHO, in almost all cases, input sanitization should be done on the server side (in this case, using the native PHP functions). If your intent is to replace PHP functionality with client-side functionality, I would strongly advise against it.

    Why?

    Just because you're authoring a website, it doesn't mean that:

    1. Your users have JavaScript enabled. If you aren't submitting your form strictly through script (using submit buttons, etc), it still allows users to submit invalid data (such as
提交回复
热议问题