Monday 22 July 2013

How to remove strip_tags in Appcelerator ?

// Here sample code to remove strip_tags from strings.

 Helpful Link : http://phpjs.org/functions/strip_tags/

 Code :

 var input = "<div>Sani</div>" // Static string
       
      strip_tags(input); // function

      function strip_tags(input) {
         var tags = /<\/?([a-z][a-z0-9]*)\b[^>]*>/gi, commentsAndPhpTags = /<!--[\s\S]*?-->|<\?(?:php)?[\s\S]*?\?>/gi;
            return input.replace(commentsAndPhpTags, '').replace(tags, '');
        }


OutPut : Sani

No comments:

Post a Comment