Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想拼凑一个快速的 HTML 预览窗口,该窗口获取文本区域的内容,并在带有单个关闭按钮的模式对话框中显示它。内容应呈现为 HTML。
不知道该怎么做……最好的方法是什么?
如果您使用的是 jQuery UI,则如下所示:
HTML
<textarea id="mytext"></textarea> <div id="dialog"></div>
JavaScript
$('#dialog').dialog({ modal: true, autoOpen: false }); function preview() { $('#dialog').html($('#mytext').val()); $('#dialog').dialog('open'); }