Tema: Cleditor
Ver Mensaje Individual
  #3 (permalink)  
Antiguo 24/11/2014, 18:43
Avatar de Patriarka
Patriarka
 
Fecha de Ingreso: enero-2011
Ubicación: Moreno, Buenos Aires, Argentina
Mensajes: 2.851
Antigüedad: 13 años, 3 meses
Puntos: 288
Respuesta: Cleditor

Sos un genio!
sabia que se podia pero nunca lo iba a descubrir.

lo siguiente es hacer lo que dice el alert: limpiar de html el texarea

entiendo que deberia ser algo asi:

Código Javascript:
Ver original
  1. <script>
  2. $("#editor_ta").attr("value",strip_tags($("#editor_ta")[0].value));
  3.  
  4. function strip_tags(input, allowed) {
  5.   allowed = (((allowed || '') + '')
  6.     .toLowerCase()
  7.     .match(/<[a-z][a-z0-9]*>/g) || [])
  8.     .join(''); // making sure the allowed arg is a string containing only tags in lowercase (<a><b><c>)
  9.   var tags = /<\/?([a-z][a-z0-9]*)\b[^>]*>/gi,
  10.     commentsAndPhpTags = /<!--[\s\S]*?-->|<\?(?:php)?[\s\S]*?\?>/gi;
  11.   return input.replace(commentsAndPhpTags, '')
  12.     .replace(tags, function($0, $1) {
  13.       return allowed.indexOf('<' + $1.toLowerCase() + '>') > -1 ? $0 : '';
  14.     });
  15. }
  16. </script>

si lo hago en el firebug veo que me limpia el el texto y me devuelve una cadena sin tags html,
pero no se actualiza el CLEDITOR

como podria resolver esto?