FF 和 Chrome 运行良好,但 IE (8) 没有在我放入 TEXTAREA 的格式化代码中保留空白
<textarea id="vdt_table_textarea" style="white-space: pre"></textarea>
和
var vdt_demo_table_string = '<table id="example" class="display">\n\
<thead>\n\
<tr>\n\
<th>Rendering engine</th>\n\
<th>Browser</th>\n\
<th>Platform(s)</th>\n\
<th>Engine version</th>\n\
<th>CSS grade</th>\n\
</tr>\n\
</thead>\n\
etc....
';
$(document).ready(function() {
$('#vdt_table_textarea').html(vdt_demo_table_string.replace(' ', ' '));
});
我怎样才能让 IE 尊重我的权威?!
最佳答案
CSS
textarea{
white-space:pre;
}
或者
textarea{
white-space:pre-wrap;
}
关于html - IE - 如何在文本区域中保留空白,使用 javascript 字符串输入,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6958388/