โ Back to HTML DOM
Question 135
Copy Text From One Element to Another
Copy Text From One Element to Another
Read the text from the span with id="source" and copy it into the span with id="dest" so both read "Hello". Platform-Provided HTML (READ-ONLY): <div id="labels"> <span id="source">Hello</span> <span id="dest"></span> </div> Steps: 1. Readdocument.getElementById("source").textContent. 2. Assign it to thetextContentof#dest.
Expected Output:
<div id="labels"> <span id="source">Hello</span> <span id="dest">Hello</span> </div>
Topics:
HTML DOM
Code Editor
1
Tab to indent ยท Ctrl+Enter to run ยท Ctrl+Space to expand shortcuts (clog, fn, fori)
Your Output
Run your code to see the output here...
Test Cases
Run your code to see test case results.