Make my new cloned div as readonly in dialog

I am sending the div content after modifications on page as a preview of that page in dialog box using clone in jquery.Now i want to make the cloned div which is previewed in dialog as readonly.How can i do that? help me

function callPreview()
{
$('#maincontainer').clone().appendTo('#previewDiv');

document.getElementById('previewDiv').disabled=true;
$.fx.speeds._default = 500;
$(function() {

        $( "#previewDiv" ).dialog({
            autoOpen: false,
            width:600,
            height:800,
            autoClose: false,
            show: "fold",
            hide: "core",
            resizable:false

        });

        $( "#previewBtn").click(function() {
            $( "#previewDiv" ).dialog( "open" );
            return false;
        });
});
}

如果只读表示不允许用户输入,但用户仍然可以选择和复制文本,则可以尝试为div中的每个“输入”元素指定“只读”属性:

$("input","#previewDiv").attr('readonly', true);
链接地址: http://www.djcxy.com/p/26690.html

上一篇: 在jQuery中引用$(this)的元素

下一篇: 使我的新克隆的div在对话框中只读