Read a Data Attribute
mediumQuestion 182Read the data-username value from the div with id="widget" using its dataset, and display it as the text of the span with id="output". The span should read "alice".
Platform-Provided HTML (READ-ONLY):
<div id="widget" data-username="alice">
<span id="output"></span>
</div>Steps:
1. Access the value with widget.dataset.username.
2. Assign it to the textContent of #output.
Expected output
<div id="widget" data-username="alice"> <span id="output">alice</span> </div>
= newline. No newline after the last line.
Hints2 available
Sign in to use hintsTopics
HTML DOM
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Shift+Alt+F to format · 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.