• Resolved culturalcandor

    (@culturalcandor)


    Hi There,

    Thanks for the great plugin, I am really enjoying it.

    I am trying to set focus on a field when the page loads.

    I thought something like:
    <script type=”text/javascript”>
    $( document ).on( ‘nfFormReady’, function( e, layoutView ) {
    jQuery(‘.nf-form-content:first’).focus();
    } ;
    Would work. However, it does not and does not return any error.

    Is it an easy way to set focus on a field?

    Thanks.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Contributor Kyle B. Johnson

    (@kbjohnson90)

    First, I’d like to mention that there are accessibility issues with setting focus on page load. Keep that in mind.

    That said, you might want to try .ninja-forms-field to target fields.

    Thread Starter culturalcandor

    (@culturalcandor)

    Hi Kyle,

    It is working thank you so much. For anybody else trying to set focus:

    jQuery(document ).on( ‘nfFormReady’, function( e, layoutView ) {
    jQuery(‘.ninja-forms-field:first’).focus();});

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Set Focus on Field’ is closed to new replies.