Ver Mensaje Individual
  #1 (permalink)  
Antiguo 27/07/2013, 11:09
Avatar de Shikari
Shikari
 
Fecha de Ingreso: mayo-2012
Mensajes: 72
Antigüedad: 12 años
Puntos: 0
Vaciar CKEditor con jQuery

¿Qué tal comunidad? Estoy haciendo un sistema de ingreso de noticias, y quiero que al cerrar la ventana se vacíen los campos, me funciona correctamente con el input normal, pero en la parte donde tengo el CKEditor, no me hace el vaciado del contenido, entonces, vengo pidiendo su ayuda a ver si me pueden auxiliar un poco.

Acá mi código:


Código Javascript:
Ver original
  1. <!DOCTYPE html>
  2. <html lang="es">
  3. <head>
  4.     <title>TecPokémon | Noticias</title>
  5.     <meta charset="utf-8">
  6.     <link rel="stylesheet" type="text/css" href="../public/css/admin-style.css">
  7.     <link rel="stylesheet" type="text/css" href="http://localhost/tecpokemon/complements/jquery-ui/css/custom-theme/jquery-ui-1.10.3.custom.css">
  8.     <link href='http://fonts.googleapis.com/css?family=Oxygen:300' rel='stylesheet' type='text/css'>
  9.     <script type="text/javascript" src="http://localhost/tecpokemon/complements/jquery-ui/js/jquery-1.9.1.js"></script>
  10.     <script type="text/javascript" src="http://localhost/tecpokemon/complements/jquery-ui/js/jquery-ui-1.10.3.custom.min.js"></script>
  11.     <script src="http://localhost/tecpokemon/includes/ckeditor/ckeditor.js"></script>
  12.     <script>
  13.         $(function(){
  14.             $('#newsAdd').dialog({
  15.                 autoOpen: false,
  16.                 modal: true,
  17.                 width: 800,
  18.                 height: 'auto',
  19.                 close: function(){
  20.                     $('#formNews input[type="text"]').val('');
  21.                     $("#editor1").empty();
  22.                 }
  23.             });
  24.  
  25.             $('#addNew').on('click', function(){
  26.                 $('#newsAdd').dialog('open');
  27.             });
  28.         });
  29.     </script>
  30. </head>
  31. <body>
  32.     <?php include('../views/admin/header-nav.html'); ?>
  33.         <div class="hiden" id="newsAdd" name="Agregar Noticia" title="Agregar Noticia">
  34.             <form action="" method="post" id="formNews" name="formNews">
  35.                 <span></span>
  36.                 <input type="text" id="title" name="title" placeholder="¡Escribe el título de la noticia!">
  37.                 <span></span>
  38.                 <textarea id="editor1" name="editor1"></textarea>
  39.                 <script>
  40.                     CKEDITOR.replace( 'editor1' );
  41.                 </script>
  42.                 <input class="btn" type="submit" value="¡Lanzar Noticia!">
  43.             </form>
  44.         </div>
  45.     <article>
  46.         <h1 style="text-align: center; padding: 10px">Noticias</h1>
  47.         <div class="btn-container">
  48.             <input class="btn-add" type="submit" id="addNew" name="addNew" value="+ Agregar Noticia">
  49.         </div>
  50.         <table>
  51.             <tr>
  52.                 <td>Título</td>
  53.                 <td>Autor</td>
  54.                 <td>Fecha y Hora</td>
  55.                 <td>Acciones</td>
  56.             </tr>
  57.             <tr>
  58.                 <td>Título</td>
  59.                 <td>Autor</td>
  60.                 <td>Fecha y Hora</td>
  61.                 <td>Editar - Borrar</td>
  62.             </tr>
  63.         </table>
  64.     </article>
  65.     <?php include('../views/admin/footer.html'); ?>
  66. </body>
  67. </html>