set html input text default launguge RRS feed

  • Question

  • HI,

    On IE 9 I have a simple html page with an input text.

    I want the default language to be hebrew when the input get the focus but its always back to english.

    I tried:

    1. define lang="he" on the input field and on the page.

    2. Tools-> ie options -> languge : set hebrew as the only lang.

    3. jquery on field got focus event: $('#fieldID').attr('lang','he');


    Monday, July 13, 2015 7:56 AM

All replies

  • Hi Iior,

    wrong sect, wrong cave... (your in the wrong forum)...

    you need to invoke a virtual keyboard in order to enter Hebrew into a textbox or input field...
    On Win8x its winkey+[Space bar] - install the Hebrew standard keyboard.

    I think its the same on Win7 (winkey+space) or you may have to tweak the keyboard and IME settings from Start>Control Panel>Keyboard... additionally you may have to do a Windows Update which will list the language packs in the optional downloads section of the Windows Updates control panel...

    but....IE9 does not support the textinput event handler (on webkit browsers its called textInput, gecko is yet to implement it.. it is not yet a client recommendation)... to preceed I would suggest that you first upgrade to IE11. If you already have the virtual keyboard installed, then it may be just the IME UI that is a bit tweaky on Win7.... wait a while after you change the input method.. I find the IME on Win7 a bit flaky and slow, or it may be that I am accidentally pressing the hotkeys (see keyboard control panel) that have been setup to toggle the input method.. sometimes my virtual keyboard selection sticks). 

    the textinput event handlers have a locale parameter with which you can determine the language of the currently active virtual keyboard.. the event handler is fired after the keypress event, so you cannot set the input elements lang and dir attributes on the focus event. (Hebrew is right to left as is Arabic). I don't think jquery has a wrapper for it. You can only attach it with addEventHandler (there is no ontextinput or ontextInput). As in the google and bing translator UI's the textarea lang and dir attributes are changed by the onchange event handler in the language select elements.


    Your best strategy is to go to or

    and check out the UI design used there... they both have language selection dropdowns which apply the required lang and dir attribute values to the textarea inputs (use the developer tool's find tool to view the markup changes when the language selection changes.)

    It has nothing to do with the current browser language (navigator.browserlangage, navigator.systemlanguage) or system language.... YOU NEED to be using a virtual or real keyboard that supports the selected input language script.

    you should also be using a content meta of utf-8. here is the first few lines of one of my multi-lingual pages.

    <!DOCTYPE html>
    <html dir="ltr" lang="en">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">

    see also the w3c html5 cheatsheet for tips for internationalization.

    see also

    Post questions about web development (html, css and scripting) using MSIE browsers to the stackoverflow forums listed here - IE Web Development forum is moving to stackoverflow

    there is also which will answer your jquery and jquery.plugins specific questions.



    Tuesday, July 14, 2015 2:37 AM
  • hi rob, thanks for the great answer.

    i'll try posring on the forum u suggested

    Tuesday, July 14, 2015 8:35 AM