Regarding textarea issue for ie 7 and ie 8

coolwaves4all

New Member
I am using the following JavaScript code.\[code\]function formatXml(xml) { var formatted = ''; var reg = /(>)(<)(\/*)/g; xml = xml.replace(reg, '$1\r\n$2$3'); var pad = 0; jQuery.each(xml.split('\r\n'), function(index, node) { indent = 0; if (node.match(/.+<\/\w[^>]*>$/)) { indent = 0; } else if (node.match(/^<\/\w/)) { if (pad != 0) { pad -= 1; } } else if (node.match(/^<\w[^>]*[^\/]>.*$/)) { indent = 1; } else { indent = 0; } var padding = ''; for (var i = 0; i < pad; i++) { padding += ' '; } formatted += padding + node + '\r\n'; pad += indent; }); return formatted; }\[/code\]This code gives me proper xml value, something like the following.\[code\] <KeyValuePair> <Key>custom.text.data</Key> <Value>This is plain text component</Value> <Value>This is plain text component</Value> </KeyValuePair>\[/code\]When I bind this value to the textarea, it is not showing properly: On the second line, it is leaving extra spaces.I want to remove that. How can I achieve this?In the textarea, it is coming like the following.\[code\]This is plain text component This is plain text component // Extra Space is Coming in this Line starting\[/code\]I have also tried setting \[code\]white-space:pre;\[/code\] and other properties, but it is not working.
 
Back
Top