โ 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. 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>
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.