12345678910111213141516171819202122232425262728 |
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="utf-8" />
- <meta name="viewport" content="width=device-width" />
- <title>Другой тайтл</title>
- <style>
- </style>
- </head>
- <body>
- <div id ='container'>
- <button id='button1'>Button</button>
- <button id='button2'>Button</button>
- <button id='button3'>Button</button>
- <button id='button4'>Button</button>
- </div>
- <script>
- function clickCounter(el){
- let counter 0;
- el.onclick = () => el.innerText = counter++
- }
- clickCounter(button1)
- clickCounter(button2)
- clickCounter(button3)
- clickCounter(button4)
- </script>
- </body>
- </html>
|