jquery - static variable in Javascript -


i want create static variable in java script. requirement "i created global variable var = 'abc'. changing variable value when doing interaction dom. if refresh page want latest value shown. possible?"

here code.

<!doctype html> <html>     <head>         <title>static variable</title>     </head>     <body>         <button onclick = "staticdemo();">click me</button>         <script>             var = "abc";             alert(a);             function staticdemo(){                 = "def";             }         </script>     </body> </html> 

you can use local storage retrieve data, after refresh. check out http://www.w3schools.com/html/html5_webstorage.asp


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -