Javascript strip_tags();





-9
Date Submitted Sat. Sep. 30th, 2006 11:06 AM
Revision 1 of 1
Scripter shachi
Tags JavaScript | strip_tags
Comments 1 comments
Strips all tags from any string.

<html>
<head>
<script type="text/javascript">
String.prototype.strip_tags = function(){
tags = this;
stripped = tags.replace(/[\<\>]/gi, "");
return stripped;
}
x = new String('<b>This is a test</b>');
document.write(x.strip_tags());
</script>
<style type="text/css">

</style>
</head>
<body>
<form>
<input type="text">
<input type="text">
<input type="button" onclick="this.form.elements[1].value = this.form.elements[0].value.strip_tags()" value="Strip 'em">
</form>
</body>
</html>
 

Shachi Bista

Comments

Comments Strips >, < .. Not Tags
Mon. Oct. 2nd, 2006 8:47 AM    Scripter ctiggerf

Voting