rendered paste body function initMCE() { tinyMCE.init({ mode : "none", theme : "advanced", plugins : "advhr,advlink,style", theme_advanced_layout_manager : "SimpleLayout", theme_advanced_disable: "hr,", theme_advanced_buttons1: "pasteword,justifyleft,justifycenter,justifyright,justifyfull,separator,removeformat,separator,charmap,advhr,separator,styleprops", theme_advanced_buttons2: "styleselect,bold,italic,underline,separator,link,separator,bullist,numlist,outdent,indent,", theme_advanced_buttons3: "", theme_advanced_toolbar_location : "top", theme_advanced_toolbar_align : "left", content_css : "css/content.css"}); } tinyMCE.init(); // code for edit in place function setClickable() { $('#editdiv').click(function() { tinyMCE.addMCEControl(document.getElementById( '#edit' ), '#edit' ); tinyMCEmode['#edit']= true; var textarea = '<div><textarea id="edit" rows="30" cols="70">'+$(this).html()+'</textarea>'; var button = '<div style="padding: 5px 0px;"><input type="button" value="SAVE" class="saveButton" /> <input type="button" value="CANCEL" class="cancelButton" /></div></div>'; var revert = $(this).html(); $(this).after(textarea+button).remove(); $('.saveButton').click(function(){saveChanges(this, false);}); $('.cancelButton').click(function(){saveChanges(this, revert);}); }).mouseover(function() { $(this).addClass("editable"); }).mouseout(function() { $(this).removeClass("editable"); }); }; function saveChanges(obj, cancel) { if(!cancel) { var t = $(obj).parent().siblings(0).val(); $.post("/admin/save.php",{ content: t },function(txt){ alert( txt); }); } else { var t = cancel; } if( t=='' ) { t='(click to add text)'; } $(obj).parent().parent().after('<div id="editdiv">'+t+'</div>').remove(); setClickable(); }