← Back to HTML DOM
Question 10
Update Span Text and Add Class
Update Span Text and Add Class
Select 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. Usedocument.getElementById()to select the span 2. Change its text content to "5" 3. Add the "active" class usingclassList.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.