i am sure its a simple thing. But i cant find the solution. My Code:
var lang='de';
$('#en').click(function (){
lang='en';
});
The variable dont change / updates on click, why?
Thanks!
Solution: works not local only on Webserver for me.
i am sure its a simple thing. But i cant find the solution. My Code:
var lang='de';
$('#en').click(function (){
lang='en';
});
The variable dont change / updates on click, why?
Thanks!
Solution: works not local only on Webserver for me.
I tried this and it seems to work fine for me. More than likely you have a scope issue.
jsFiddle
Sure it does. Here is the jsFiddle test -
http://jsfiddle.net/RfDCU/
With your Html revision it works too -
http://jsfiddle.net/RfDCU/1/
Are you sure the lang variable is within function scope?
Maybe you are missing the document.ready
?
$(function(){
var lang='de';
$('#en').click(function (){
lang='en';
});
});