Good morning,
I know it should be a basic thing, but I'm having trouble with it.
The site contains two languages, when clicking on a flag, the language of the site changes and the flag for the language is colored, while the other flag is in Black and White, but when I click on a flag, it is selected and updates the page automatically, returning to the other flag. Could someone help me?
HTML
<div class="languages">
<a href="<?=URL_SITE?>/idiomas/changeLanguage/portugues">
<img id="br" class="active" src="<?=ICONES?>br-flag.png">
</a>
<a href="<?=URL_SITE?>/idiomas/changeLanguage/espanhol">
<img id="es" src="<?=ICONES?>es-flag.png">
</a>
</div>
SCRIPT
<script type="text/javascript">
$(document).ready(function() {
$('img').click(function() {
$('img.active').removeClass("active");
$(this).addClass("active");
});
});
</script>
CSS
.languages img{
margin-left: 3px;
filter: grayscale(1);
-webkit-filter: grayscale(1);
}
.languages img:hover, .languages img.active{
filter: grayscale(0);
-webkit-filter: grayscale(0);
}