Update Span Text and Add Class
mediumQuestion 10Select the span with id="counter" and change its text to "5", then add the CSS class "active" to it.
Platform-Provided HTML (READ-ONLY):
<div id="dashboard">
<span id="counter">0</span>
</div>Steps:
1. Use document.getElementById() to select the span
2. Change its text content to "5"
3. Add the "active" class using classList.add()
Expected output
<div id="dashboard"> <span id="counter" class="active">5</span> </div>
= newline. No newline after the last line.
Hints4 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.