I have read a lot of answers here about changing the site language with jQuery but nothing worked for me.
Well, I have a website as an example: www.domain.com Inside I have folders for the languages. /en/ English pages, /el/ Greek pages. All pages are the same, both for English and Greek. index.html, gallery.html etc
I have two flag icons in the top right header page to change the language.
I want, when the user clicks the British flag, to go to /en/page.html and when the user clicks the Greek flag to go to /el/page.html.
<script>
$(document).ready(function(){
$('a').click(function() {
document.location.href =document.location.href.replace('/el/' '/en/');
});
});
</script>
And here is my html code:
<head>
<a href="javascript:;"><img src="../images/flagen.gif"></a>
</head>
In this example I am on Greek page rootwww/el/index.html and I want to replace /el/ with /en/ folder path and go to /en/index.html
What I am doing wrong?