Hello,
I was interested adopting ckeditor 3 with the exemple showed http://nightly.ckeditor.com/4303/_samples/divreplace.html there...
The code works great.. the ckeditor appears after a double-click as expected.
It may have been answered before but I did not found an answer after some researches. so I was wondering how to grab the text modified in the ckeditor and send it in a $_POST variable.
Any help would be appreciated.
<head> <script type="text/javascript" src="ckeditor/ckeditor.js"></script> <style id="styles" type="text/css"> div.editable { padding-left: 15px; padding-right: 15px; } div.editable:hover { border-color: black; } </style> <script id="headscript" type="text/javascript"> //<![CDATA[ // Uncomment the following code to test the "Timeout Loading Method". // CKEDITOR.loadFullCoreTimeout = 5; var editor; window.onload = function() { // Listen to the double click event. if ( window.addEventListener ) document.body.addEventListener( 'dblclick', onDoubleClick, false ); else if ( window.attachEvent ) document.body.attachEvent( 'ondblclick', onDoubleClick ); }; function onDoubleClick( ev ) { // Get the element which fired the event. This is not necessarily the // element to which the event has been attached. var element = ev.target || ev.srcElement; // Find out the div that holds this element. element = element.parentNode; if ( element.nodeName.toLowerCase() == 'div' && ( element.className.indexOf( 'editable' ) != -1 ) ) replaceDiv( element ); } function replaceDiv( div ) { if ( editor ) editor.destroy(); editor = CKEDITOR.replace( div ); } //]]> </script> </head> <body> <?php echo($_POST['editable']); ?> <form method="post"> <div class="editable"> <p> testing </p> </div> <input type="submit" /> </form> </body> </html>