FuncJS Library Docs

Select the documentation you want to view from the right hand panel below.

Select a page to view from the panel below. list of Functions 1. echo() - Nov 16 2012 2. print() - Nov 16 2012 3. function_exists() - Nov 16 2012 4. strlen() - Nov 16 2012 5. strpos() - Nov 16 2012 6. str_replace() - Nov 16 2012 7. findLast() - Nov 16 2012 8. up() - Nov 16 2012 9. down() - Nov 16 2012 10. storage() - Nov 17 2012 11. FormValidate() - Nov 16 2012 12. isset() - Nov 16 2012 13. changeTitle() - Nov 16 2012 14. str_rev() - Nov 16 2012 15. get() - Nov 16 2012 16. count() - Nov 16 2012 17. len() - Nov 16 2012 18. stripslashes() - Nov 16 2012 19. strip_tags() - Nov 16 2012 20. show_tags() - Nov 24 2012 21. split() - Nov 16 2012 22. grab() - Dec 15 2012 23. findLinks() - Nov 16 2012 MISCELLANEOUS 1. Get Started - Nov 14 2012 2. Functions in FuncJS - Nov 16 2012 3. Leave Feedback - Nov 02 2012
strip_tags()
The strip_tags() function searches for and removes an unlimited number of tags from a string. This function accepts and requires one parameter, and can remove tags with or without attributes.

Syntax:
strip_tags(source);


Example:
<html>
<head>
<script type="text/javascript">
var src = "<strong>This piece of string is bold</strong> but this <em>isn't</em>";
var remove_tags = strip_tags(src);
echo(remove_tags);
//this should output "This piece of string is bold but this isn't"
</script>
</head>
</html>

If you're familiar with PHP, you should have no trouble understanding how this function works. For a greater understanding, please test this function in your Web Console.

Additionally, you can play around with the demo below to see this function in action on a live webpage! Enter some text with at least one word covered in HTML tags, and then click "Remove tags" to see the text alerted without the tags.




Source code for demo above:
<input type="text" id="txt">
<input type="button" id="remove-tags" value="Remove tags">
<script>
get("id", "remove-tags").addEventListener("click", function() {
if(get("id", "txt").value!==null) {
alert(strip_tags(get("id", "txt").value));
} else {
return false;
}
}, false);
</script>