Friday, 25 January 2013 17:44

how to remove html tags from html string in client side

Written by 
Rate this item
(0 votes)

sometimes needed that html tags from a html string
to be removed.there are many purposes to do that.
there are many ways this can be achieved in client side
using jquery and javascript -

following is a simple and good way to do that -

var s2="";
var htmlInput = "<b>c# <br/> asp.net";
s2 = htmlInput.replace(/<[^>]*?>/g, '');

alert(s2);

this will result s2= "c# asp.net";

when you use editor you may want to compare only editor html
text not with tags.

hope this helps............

Read 2907 times
Super User

Email This email address is being protected from spambots. You need JavaScript enabled to view it.

Latest discussions

  • No posts to display.