jsUtils.stripTags()

stripTags

jsUtils.stripTags( str )
  str - string variable

Returns string without HTML or XML tags.

Allowing uses to input HTML into text and saving it into the database might be a security rist. This function allows to clean user generated text and remove all tags.

Example

<!DOCTYPE html>
<html>
<head>
    <script src="system/libs/jsUtils.js" type="text/javascript"></script>
    <script type="text/javascript">
        window.onload = function() {
            alert(jsUtils.stripTags('<b>some html</b>'));
        }
    </script>
<body>
</body>
</html>

See Also