Hi,
You can try this
function _notags(x){return x.replace(/<\/?[^>]+>/gi,"")}
But it is important to point out that you need to also do HTML/Tag
stripping on the server side script too as your client side javascript
checking could be bypassed (or disabled) so you always need that
server side cleansing also.
If using PHP you can check out some of these links
http://www.php.net/strip-tags
http://www.php.net/manual/en/function.htmlentities.php
http://www.php.net/manual/en/function.htmlspecialchars.php
(If you require all HTML character entities to be translated, use
htmlentities() instead.)
With regard to the other part of your question, while this will strip
tags from strings (x) some email clients will automatically convert
urls into clickable links so you may have no control if someones email
client converts
www.domain.com into a clickable link. If you are
really against it, then another option people use is to convert the
dots to '(dot)' so it would read www(dot)domain(dot)com. You can just
do a string replace on the returned data (or add it to the function I
posted) >>
http://www.w3schools.com/jsref/jsref_replace.asp
eg. function _notags(x){return x.replace(/<\/?[^>]+>/gi,"").replace(/
\./g, "(dot)");}
You may need to tweak it a bit so it does not convert end of sentence
periods as (dot) also, but if your only doing it to form values (like
email addys and names etc) then it should not matter as much as your
not stripping chunks of HTML code.
Hope that helps :-)
Cheers!
Vision Jinx