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

438
Vistas
I'm trying to capture some text contents from a HTML file, and populate it to another HTML file using Javascript, but why my codes don't work?

I have two HTML files, and I want to change the content of one HTML file by the content of another one. Here are the code segments:

original.html:

<p id="old_1">this is old data</p>

new.html:

<textarea id="new_1" rows="8" cols="80"  style="width:100% !important;"></textarea>
<input type="button" onclick="popData()" id="button_1" value="Send" style="width:100% !important;"/>

I also have a separate js file with function:

function popData()
{
var newContent=document.getElementById("new_1").value;
document.getElementById("old_1").innerHTML=newContent;
}

When I write some thing in the text area, and click the button, the function popData() is called, but when I come back to the original.html, nothing has been changed. Do I need to use PHP? Is it possible to implement it with Javascript and HTML only? And no Iframe.

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

0

As these are two separate html files, there is no means of data flow between them.

document.getElementById("new_1").value should work fine if both textarea and <p> tag is on a single html file.

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