Search code examples
jquerytextareaselectortranslate

Do NOT translate textarea by jQuery.translator, how?


I use jQuery.translate, very normal code as:

$('body').translate(...

Now I do not want the textarea and input:text get translated, so I tried:

$('*:not(textarea,:text)').translate(..
$('body *:not(textarea, input:text)').translate(

None working.

(these answers got from another question: jQuery, Select Body but exclude Textarea and Input:Text, how?

Anyone here, has an idea how to translate the body but exclude textarea and input:text, thanks.


Solution

  • From the jQuery.translate wiki; first add the notranslate class to the elements you don't want to translate.

    $('textarea').addClass('notranslate');
    $('input:text').addClass('notranslate');
    $('body').translate(...);