Remove/Strip Html tags Java Script

This javascript function will help you to remove/strip HTML tags typed in text area or in text box.

Features

  • You can remove the html tags typed in a textarea/textbox.
  • This javascript displays strips any character or tags given inside the tag.
  • Just copy the code in to your page and use it.
  • Simple and ease of use.

Preview

Type your data with HTML Tags in Textarea / Textbox

Downloads

Javascript Code
<!-- Script by hscripts.com -->
<script type="text/javascript">
function stripHTML()
{
var re = /(<([^>]+)>)/gi;
for (i=0; i < arguments.length; i++)
arguments[i].value=arguments[i].value.replace(re, "")
}
</script>
<!-- Script by hscripts.com -->

  HTML Code
<!-- Script by hscripts.com -->
<form name="myform">
<textarea style="background-color:f0f0f0; border 1px border:1px solid #afc784;" name=remove rows=4 cols=40></textarea><br>
<input type="button" value="Remove HTML Tags" onClick="stripHTML(this.form.remove)">
</form>
<!-- Script by hscripts.com -->
  • Release Date - 23-12-2007
  • Get free version without ©copyright link for just $10/-
  • For customization of this script or any script development, mail to support@hscripts.com

Usage

  • Here we have explained how to use the strip html tag javascript with the help of a form. When you click remove HTML tags button, it will remove the html tags entered into textbox.
  • Copy the javascript code into the part of your HTML page.
  • Copy the HTML code, to create a textarea into the <body> tag.
  •  <form name="myform" METHOD=POST>
    <textarea name="remove" rows=3 cols=40</textarea>
    <input type="submit" value="Strip HTML tags" onSubmit="stripHTML(this.form.remove)">
    </form>
  • In the preview of strip HTML tags we have used form field as button instead of submit to demonstrate its functionality
  • The java script function "StripHTML()" will remove the HTML tags typed in textarea or text box.

License

Related Scripts

Free Javascript Scripts


Ask Questions

Ask Question