File tree Expand file tree Collapse file tree 2 files changed +30
-0
lines changed
dom-manipulation/printnums Expand file tree Collapse file tree 2 files changed +30
-0
lines changed Original file line number Diff line number Diff line change 1+ <!DOCTYPE html>
2+ < html lang ="en ">
3+ < head >
4+ < meta charset ="UTF-8 ">
5+ < meta name ="viewport " content ="width=device-width, initial-scale=1.0 ">
6+ < meta http-equiv ="X-UA-Compatible " content ="ie=edge ">
7+ < title > Document</ title >
8+ < script defer src ="script.js "> </ script >
9+ </ head >
10+ < body >
11+
12+ < input type ="number " id ="num ">
13+ < button id ="btn "> PRINT</ button >
14+ < ul id ="list "> </ ul >
15+
16+ </ body >
17+ </ html >
Original file line number Diff line number Diff line change 1+ let num = document . getElementById ( 'num' )
2+ let btn = document . getElementById ( 'btn' )
3+ let list = document . getElementById ( 'list' )
4+
5+ btn . onclick = function ( ) {
6+
7+ let N = parseInt ( num . value )
8+
9+ for ( let i = 1 ; i <= N ; i ++ ) {
10+ list . innerHTML += '<li>' + i + '</li>'
11+ }
12+
13+ }
You can’t perform that action at this time.
0 commit comments