1

I'm using Materialize and try to change the options's text via js/jquery for multilingual use.

<select>
    <option value="" disabled selected data-translation="languageselect"></option>
    <option values="en-GB">English (en-GB)</option>
    <option values="de">Deutsch (de)</option>
</select>

I translate all objects containing the data-translation attribute via JS (using innerHTML).

So the translation script is something like (and it works)

translationObject.innerHTML = translation

But now I'm using Materialize and have a problem with the options texts. The translated text is not displayed - first I call my translation function and then the initialization of the select element.

$('select').formSelect(); 

Anyone an idea?

dan1st
  • 12,568
  • 8
  • 34
  • 67
michaelT
  • 1,533
  • 12
  • 41

0 Answers0