Editar elementos dentro de iframe con contentEditable="true"

I have an iframe inside my html code like this.

  <iframe src="demo.html"></iframe>

The demo.html contains some tags with the contentEditable="true" attribut like this.

  <p contentEditable="true">bla bla bla bla bla</p>

when i open the demo.html file separately i can edit the p tag without problems, however when i open the html file that contain the iframe i cannot edit the paragraph.

Please any idea on how to fix this.


preguntado el 27 de noviembre de 13 a las 01:11

2 Respuestas

Usually I see contentEditable div or an iframe. I'd like to know more as well if you find out.

respondido 27 nov., 13:02

<!-- /enabled jayscript/ -->

  <!-- .load demo.html content -->
  <iframe src="demo.html" style="">You do not support iframes...</iframe>

<!-- Below is code in demo.html 
      .modify demo.html content -->
<div contenteditable="true">
  Blah blah blah  

<!-- \enabled jayscript\ -->

This seemed to work for me in modern Chrome. Just make sure to use the contenteditable attribute on div tags and also set the dimensions of the iframe if this does not work. In this example I also used a library I have been creating called jayscript, so excuse the comments that are meant for that. Tested and works without jayscript nevertheless... If this still doesn't work for you, I don't know what your problem is (need to be more specific)..

Respondido el 05 de enero de 17 a las 20:01

also, there is no demo.html for me to put in iframe so my snippet shows them seperately. - Cannicida

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.