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 -

javascript - Get parameter of GET request -

javascript - Twitter Bootstrap - how to add some more margin between tooltip popup and element -