Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

201
Vistas
Is it possible to set the value property of a <textarea> tag to be the source code of an html file?

I want to know if it is possible to set the value property of a <textarea> tag to be set to the HTML of a webpage.

I'm trying to set the value to be equal to the HTML of the local file "./file.html".

document.getElementById("textareaTag").value = ;

Since I'm new to JavaScript, I don't have a solution, even though there probably is one. Can anyone help me?

NOTE: Some digging around makes it look like it might be possible to accomplish this with a window.open() command. Would it work? If so, how?

about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

You can place an HTML file into a JS variable by this method:

Load page content to variable

And then put variable into textarea. Although in textarea you can't show html tags and you need a WYSIWYG rich text editor like CKEditor.

about 4 years ago · Juan Pablo Isaza Denunciar

0

I'm not sure if I understand your question, but I'll try my best to answer.

You can set the text inside of a <textarea> using the .innerHTML property, as the textarea tag has an opening and closing tag.

Use the code below:

document.querySelector("textarea").innerHTML = "Textarea!";

EDIT: Editing the text on a different webpage is a security risk.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda