I have found this great code snippets on this blog to change the language selector for something more stylish. (Twitter-bootstrap in mind)
It looks pretty neat, however when I actually click on the selection, nothing is submitted on onclick. I am not yet an expert in jquery, but could something have been deprecated in latest 1.8.0 version that stops the onclick from working?
<form name="setLang{{ lang.1}}" action="/i18n/setlang/" method="POST">{% csrf_token %}
<input name="next" type="hidden" value="{{ redirect_to }}" />
<input type="hidden" name="language" value="{{ lang.0 }}" />
<a href="#" onclick="document.setLang{{ lang.1 }}.submit(); return false;">{{ lang.1 }}</a>
</form>
You can’t use
document.setLang{{ lang.1 }}to get theform. That’s not a valid name for a DOM element. JavaScript will break processing at the first whitespace it encounters, and throw an error.I strongly suggest you use a valid
namevalue, but if you really need to keep using that, you can access the element withdocument.getElementsByName("setLang{{ lang.1}}")[0].submit().