View Full Version : removing html tags
nolsie
29 Oct 2007, 5:06 AM
how do I remove the html tags when I display text in a TextArea? :-/
You could try something like
function stripTags(str) {
str = str.replace(/<.*>/g, '');
return str;
}
I think that should remove all instances of <.*> from the string.
There wouldn't be a way to get them back, however.
dolittle
29 Oct 2007, 5:42 AM
maybe htmldecode?
http://extjs.com/deploy/ext/docs/output/Ext.util.Format.html#htmlDecode
nolsie
30 Oct 2007, 1:47 AM
I decided to use stripTags, but I get a [object Object] in the TextArea!
dsDocument.on('load', function(){
var str = Ext.util.Format;
str.stripTags(dsDocument.getAt(0).data.content );
content_field.setValue(str);
form.render('document');
});
content_field is my TextArea.
tryanDLS
30 Oct 2007, 7:49 AM
Set a BP on that line and verify that you're actually passing a string to stripTags.
Powered by vBulletin® Version 4.1.5 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.