Over-ride Chrome Browser spell check language using JQuery or JavaScript Over-ride Chrome Browser spell check language using JQuery or JavaScript google-chrome google-chrome

Over-ride Chrome Browser spell check language using JQuery or JavaScript


tl;dr

You can change the language using setAttribute('lang', lang) but Chrome doesn't use the lang attribute for spellcheck. This is a won't fix issue. Check the thread for more info.


Instead Chrome makes use of the user dictionaries which has to be selected by the user. (Try right-clicking a text-area -> Spellcheck -> Select language). Also the user should have the dictionary installed or else the spellcheck will not be possible.

You can try the following script and note that changing the lang attribute will not have effect but changing the language manually as mentioned above will.

function toLang(lang) {  document.getElementById('id_objective_details').setAttribute('lang', lang);}
<h3>Here is some random German text</h3><p>Hallo Welt, hallo und hallo wieder Welt.</p><h3>Here is some random English text</h3><p>Hello world, hello and hi again world.</p><textarea cols="40" id="id_objective_details" maxlength="1000" name="objective_details" rows="10" class="kmw-disabled keymanweb-font textArea01" spellcheck="true"></textarea><br><button onclick="toLang('en')">English check</button><button onclick="toLang('de')">German check</button>

You can perhaps use some external libraries like JavaScript SpellCheck or JQuery SpellCheck to get the job done.