M
ma.giorgi
hi to all!
I've tried in all the way but I can't find a solution
I show you an example:
I have the following html code:
<div id="aaa">text inside<br/> a div</div><span class="bbb"> text
inside a span</span><img src="blabla"/><p class='ccc'
style='blablabla'>text inside a <b style="FONT-SIZE:
14px">paragraph</b> with some<!--Hey I'm a f$*!#ng comment--> bold
text</p>
I need to tranform this text into clean html, like this:
text inside a div text inside a span<p>text inside a paragraph with
some bold text</p>
I've tried this:
function cleareTags(){
var stringToReplace = String(document.theform.ArticleText.value);
var re=/(<\/?p)(?:\s[^>]*)?(>)|<[^>]*>/gi;
document.theform.ArticleText.value = stringToReplace.replace(re,'');
}
but nothing...it removes all the tags
I've tried also this way
function cleareTags(){
var r=/<(\w{1})([^>]*)>(.*)<\/\1>/gmi;
document.theform.ArticleText.value = stringToReplace.replace(r,
function(s,tag,attr,inner) {
//alert (inner)
return
(tag.toUpperCase()=="P"?"<"+tag+">"+inner+"</"+tag+">":inner);
}
);
}
but nothing happen...
please help me
My resources are at the end
bye
marco
I've tried in all the way but I can't find a solution
I show you an example:
I have the following html code:
<div id="aaa">text inside<br/> a div</div><span class="bbb"> text
inside a span</span><img src="blabla"/><p class='ccc'
style='blablabla'>text inside a <b style="FONT-SIZE:
14px">paragraph</b> with some<!--Hey I'm a f$*!#ng comment--> bold
text</p>
I need to tranform this text into clean html, like this:
text inside a div text inside a span<p>text inside a paragraph with
some bold text</p>
I've tried this:
function cleareTags(){
var stringToReplace = String(document.theform.ArticleText.value);
var re=/(<\/?p)(?:\s[^>]*)?(>)|<[^>]*>/gi;
document.theform.ArticleText.value = stringToReplace.replace(re,'');
}
but nothing...it removes all the tags
I've tried also this way
function cleareTags(){
var r=/<(\w{1})([^>]*)>(.*)<\/\1>/gmi;
document.theform.ArticleText.value = stringToReplace.replace(r,
function(s,tag,attr,inner) {
//alert (inner)
return
(tag.toUpperCase()=="P"?"<"+tag+">"+inner+"</"+tag+">":inner);
}
);
}
but nothing happen...
please help me
My resources are at the end
bye
marco