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;
});
});
}
If readonly means that no input from user allowed,but still, the user can select and copy text, you can try to specify the ‘readonly’ attribute for each ‘input’ element in the div: