'Autofocus Gravity Form Field

Trying to get a cursor to appear in one field in my Gravity Form. This is my Javascript, but it's not working:

<script type="text/javascript">
jQuery(document).ready(function($) { jQuery('#input_22_1').focus(); });
</script>

I've double checked the input several times to make sure I had the correct one yet this isn't working. The page I'm trying to get it working on is here: http://tinyurl.com/h8muwvp and the field is the Name of Business field.



Solution 1:[1]

You have a syntax error in your Javascript. From the console:

Uncaught SyntaxError: Unexpected token <

custom_js.js:7

A more elegant solution would be to use the HTML autofocus attribute on the form field.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Kyle O