Issue
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>
Solution
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"/>
Answered By - dave
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.