In Joomla, I am switching between languages not using the country flags as the indicator which language I am on but switch the text from English to Afrikaans using jQuery's replaceWith() method.
Problem I am having is that on first click of the word English, to change it to Afrikaans, the link does not work. It does however work on the toggle when it needs to come back.
Would appreciate the help please. Here's my logic of how I think it should work:
jQuery(document).ready(function($) {
$(".item48").toggle(
function () {
$(this).replaceWith("<li class='active item48' id='current'><a href='index.php?lang=af'><span>English</span></a></li>");
},
function () {
$(this).replaceWith("<li class='active item48' id='current'><a href='index.php?lang=en'><span>Afrikaans</span></a></li>");
}
);