Remove text using JS
Consider I ahve the following text:
<h4>The quick brown fox jumps over the lazy dog and feels as if he were in the seventh heaven. Why does it jump quick over a dog?</h4>
If I want to remove " and feels" as well as " quick"
I should end up with this:
<h4>The brown fox jumps over the lazy dog as if he were in the seventh heaven. Why does it jump over a dog?</h4>
Is this possible? If so can someone provide a working example.
Yes, it is very possible. You need to learn something about Regular Expressions.
aka RegEx and RegExp. There are thousands of tutorials when you search google.
inpStr="The quick brown fox jumps over the lazy dog and feels as if he were in the seventh heaven. Why does it jump quick over a dog?"
rAry=new Array("and feels","quick");
Thank you for your reply.
And yes, Google is my friend. I tried your code, and it works. However it only works on the text you declare in the var and spits it out without whatever has been specified. What If I wanted the script to scan a page which all ready has the text on it. I.E scan the page and delete/replace certain words.