Jquery不在html中显示UL或LI标签

时间:2013-05-14 20:28:02

标签: jquery html tags

我有一个简单的代码:

//preview copy as it's being typed
$('#copyText').keyup(function(e){
    $('#copyPreview').html($('#copyText').val());
});

当用户输入html时 - 他们可以看到保存时的预览。

However certain tags such as <ul> and <li> are not appearing. Other HTML works such as line breaks, bold, tables, even styles... just not lists (so far, from what I see) 

你可以认为它不是css,因为我检查了它。

示例文本:

<b>All models are UL recognized <br><b>Important:</b> <br>
<ul><li>Adjustable range from -73 to 316°C (-100 to 600°F)</li>
<li>Resolution sensitivity of -17.7°C</li>
</ul>   

1 个答案:

答案 0 :(得分:0)

val()用于

  

获取匹配元素集中第一个元素的当前值

用户html()改为

$('#copyPreview').html($('#copyText').html())