This javascript function will help you to remove/strip HTML tags typed in text area or in text box.
Features
a)You can remove the html tags typed in a textarea/textbox.
b)This javascript displays strips any character or tags given inside the tag.
c)Just copy the code in to your page and use it.
d)Simple and ease of use.
Preview for Strip HTML Tag
Code
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 -->
For customization of this script or any script development, contact us at 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 <head> 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
- The javascript (misspelled as java script) is given under GPL License
- i.e. Free use for those who use the codes as it is.
- Free, if your modification does not remove our copyright information and links.
- Click Here for detailed license information.
- You can purchase the script if your requirements does not meet our GPL License terms.