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

124
Views
why can't I insert text object into an element's innerHTML

we can assign the input value to a variable and then we're assingning that variable to an element's innerHTML, likewise why can't I insert text object into an element's innerHTML??

eg code:

x=document.getElementById("my_input"). value;

y=document.createElement("p");

y.innerHTML=x;

This code works but the below code isn't, why?

eg code:

x=document.getElementById("my_input"). value;


y=document.createElement("p");

z=document.createTextNode("x");

y.innerHTML=z;

I'm a beginner in js.. Correct me if I'm wrong..thanks!!

about 4 years ago · Juan Pablo Isaza
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!