Getting focus on a data field on google sites

  • Profile Image
    Asked on February 21, 2017 at 05:57 PM

    I need the first and only field to have focus on loading the website so I can utilize a barcode scanner without the user having to select the data field.  I have successfully embedded the Jotform

    into, and it is working but I cannot get the focus to work using the code I have found in this forum.... 


  • Profile Image
    Answered on February 21, 2017 at 11:01 PM


    To be able get focus on the field when your form loads on the site, you need first to get the full source code of your form and embed to your site. After that, based from your form the field id is input_5. Please remove the # on #input_5.Can you please try this code below and see if this works?


    document.observe("dom:loaded", function() {





    And also, please make sure that your browser is allowed to load JavaScript codes.

    Hope this helps.



  • Profile Image
    Answered on February 22, 2017 at 10:56 AM

    I appreciate the help, but I just cant seem to get it to work.  I have tried Google Chrome, IE11, and safari on my iphone.


    Javascript is enabled, and I copied the source code into the HTML box.  The form submits fine, but no focus.

    Has anyone ever done this on Google Sites (classic)?..the newest Google sites uses a Gadget, which doesn't seem to allow editing of the code

  • Profile Image
    Answered on February 22, 2017 at 01:46 PM

    It seems your filed ID in the embedded form is the following:


    Try using that instead of input_5 in your script.