TL; DR
You can change the language with setAttribute('lang', lang) , but Chrome does not use the lang attribute to check spelling. This one will not fix the problem . Check the stream for more information.
Instead, Chrome uses custom dictionaries that must be selected by the user. (Try right-clicking the text area β Spellchecking β Choose language). The user must also have a dictionary installed, otherwise spell checking will not be possible.
You can try the following script and notice that changing the lang attribute will not have an 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>
Perhaps you can use some external libraries, such as JavaScript SpellCheck or JQuery SpellCheck , to complete the task.
source share