โ Back to HTML DOM
Question 19
Change Link Href and Text
Change Link Href and Text
Select the link with id="navLink" and change its href to "https://example.com" and its text content to "Visit Example". Platform-Provided HTML (READ-ONLY): <div id="navigation"> <a id="navLink" href="#">Old Link</a> </div> Steps: 1. Use document.getElementById() to select the link 2. Change its href attribute to "https://example.com" 3. Change its textContent to "Visit Example"
Expected Output:
<div id="navigation"> <a id="navLink" href="https://example.com">Visit Example</a> </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.