Whats wrong with this script? It resets itself and the second div never changes. I'm missing something? I'm thinking I probably need a better way to handle the variable so if someone knows of one that would be awesome. This is my jsfiddle testing script:
var lang="de";
$('#en').click(function () {
lang="en";
});
$('#de').click(function () {
lang="de";
});
$('#es').click(function () {
lang="es";
});
function showtext() {
$('#text').text(lang);
if (lang="en") {
$('#cur').text(lang);
}
else if (lang="de") {
$('#cur').text(lang);
}
else if (lang="es") {
$('#cur').text(lang);
}
}
showtext();
setInterval(function () {
showtext();
}, 2000);
Demo on jsfiddle