product icon

How to Set Focus Automatically on Textarea at Session Start

    Articles related to customization are written for a technical audience who have experience in web development. Knowledge of HTML, CSS, and JavaScript are required.

    File to edit: LanguagesForChatOnlyMode.js

    var ic_hic_demo_timer1 = null;
    var ic_hic_demo_timer2 = null;
    ic_hic_demo_timer1 = setInterval(ic_hic_demo_timer_checkobject1, 100);
    function ic_hic_demo_timer_checkobject1()
    {
      if ((ICObject != null) && (ICObject.pChatText != null))
      {
        clearInterval(ic_hic_demo_timer1);
        ICObject.pChatText.onfocus = function()
        {
          clearInterval(ic_hic_demo_timer2);
          ICObject.pChatText.onmousedown();
        }
        ic_hic_demo_timer2 = setInterval(ic_hic_demo_timer_checkobject2, 100);
      }
    }
    function ic_hic_demo_timer_checkobject2()
    {
      try
      {
        ICObject.pChatText.focus();
      }
      catch (ex) {}
    }
    Article last updated: 27 September, 2022