I had made one div
tag and stored its contents in a variable. If this tag contains p,b
or any other tags then it should be removed from string. How
Solution Using JQuery:
var content = "Dear Andy,
This is a test message.
";
var text = $(content).text();
Solution using JavaScript:
function removeTags(){
var txt = document.getElementById('myString').value;
var rex = /(<([^>]+)>)/ig;
alert(txt.replace(rex , ""));
}
Also look a this link: Strip HTML Tags in JavaScript