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

216
Views
Is it possible to pass value of <p> to <input>

I have a <p> that prints a value is it possible that the value can be printed in the <input>?

for example:

<p>2</p>

<input type="number">2</input>
about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

This will require the use of Javascript. Add an id to your paragraph and input so you can identify them, then set the value of your input field to the textContent of your paragraph:

let myParagraph = document.getElementById('my-paragraph');
let myInput = document.getElementById('my-input');

myInput.value = myParagraph.textContent;
<p id="my-paragraph">2</p>

<input type="number" id="my-input"/>

about 4 years ago · Juan Pablo Isaza Report

0

Input element has an attribute called value.
So you can do -

<input type="number" value=2 />
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!