Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <meta http-equiv="X-UA-Compatible" content="IE=edge">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title>Document</title>
- </head>
- <body>
- <button onclick="handleClick()">+1</button>
- <i>0</i>
- </body>
- <script>
- console.log('hi');
- const ielem = document.querySelector('i');
- if (!sessionStorage.cnt) {
- sessionStorage.cnt = new Number(0);
- }
- ielem.innerText = sessionStorage.cnt;
- function handleClick() {
- ielem.innerText = String(++sessionStorage.cnt);
- }
- </script>
- </html>
Add Comment
Please, Sign In to add comment