如何弹出编辑的内容

How to popup edited content?

本文关键字:编辑 何弹出      更新时间:2023-09-26

我想编辑页面中的内容,并通过单击按钮弹出整个页面编辑的内容。怎样才能做到呢?我需要帮助。下面是一段代码,这是一个JSFiddle。

HTML

<!--just an example-->
<div id="dialog" title="Basic dialog">
    <form>some forms here</form>
    <p>edit here and popup.</p>
</div>
<button id="previewr">popup</button>
JavaScript

$('body').on('dblclick','p', function()
{
    $(this).attr('contentEditable', true);
});

类似于

var w = window.open('','win', 'width=500,height=300');
var html = $('body').html(); // -- get current text
w.document.open();
w.document.write(html); // -- write to new window
w.document.close();

这个jsFiddle显示新旧