<li><a href="/home/index.php?l=fr" id="flag_fr" class="langLink" rel="fr"><img src="../images/flag_fr.gif" alt="FR" /><span></span></a> </li> <li><a href="/home/index.php?l=de" id="flag_de" class="langLink" rel="de"><img src="../images/flag_de.gif" alt="DE" /><span></span></a> </li>
The idea is that when the document loads, jquery sets a new click handler to call a function rather than use the link's href. The function will then disable the language links while an ajax operation is performed to load the new language xml file.
function changeLang(targ) {
//disable language links
$("a.langLink").click(function() { return false; });
alert($(targ).attr('rel'));
}
$(document).ready(function(){
$("a.langLink").click(function() { changeLang(this); return false; });
});
Overriding the href works fine, and so when clicking the links the alert is displayed correctly, but the links retain the old functionality and continue to call changeLang() rather than just returning false. Anyone have any ideas?

New Topic/Question
Reply



MultiQuote



|