How to set cursor focus on any form field when the form is loaded?

  • Profile Image
    spearmaiv
    Asked on May 10, 2016 at 12:49 AM

    Dear Abajan,

     

    Can you help me with my form? I want my field to have an auto cursor focus over the member number field like you do in your demo for last name.

    https://form.jotform.com/61298805520154

     

    Thanks

  • Profile Image
    spearmaiv
    Answered on May 11, 2016 at 03:49 PM

    Any update on this?

  • Profile Image
    Huberson
    Answered on May 11, 2016 at 04:45 PM

    To add autofocus to a field you simply need to add the following script to the form Source code and host it on your website.

    <script type="text/javascript">

    document.observe('dom:loaded', function() {
    $('field-ID').activate();
    });

    </script>

    You will need to replace 'field-ID' with the field's ID you need focus once the page load - How-to-find-Field-ID.

  • Profile Image
    spearmaiv
    Answered on May 11, 2016 at 04:52 PM

    How would I go about hosting it on my website? I am currently using Weebly. Or an example would be great. 

     

    Thanks 

  • Profile Image
    Huberson
    Answered on May 11, 2016 at 05:40 PM

    You simply need to add the modified source code to a page from your Weebly site using the 'Embed code' button on the left panel.

    You can also Google 'how to add custom HTML code to Weebly' to find some videos and guides.

     

    Do let us know if you need further assistance.