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
Post a Comment