Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

435
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!