• Resolved Madyson

    (@madyonhope1998)


    On the Sign up page of the website when I click enter nothing happens but when I actually click the ‘Next’ button it comes up with the next bit of information required for the sign up. I am not a developer and was wondering if there was a simple way of fixing this so that clicking enter gives the same result as clicking the ‘Next’ button.

Viewing 5 replies - 16 through 20 (of 20 total)
  • Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    Oh sorry I misunderstood your intention. I will rewrite the code shortly.

    Thread Starter Madyson

    (@madyonhope1998)

    I want the same thing to happen if I press enter like it does when I click next?

    Thread Starter Madyson

    (@madyonhope1998)

    Thank you very much for your help

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    Try replacing all of the code that I recommended before, with the below:

    var $ = jQuery,
        context = $('#register-page'),
        submitButton = context.find('#signup_submit'),
        extraFields = context.find('#extra-fields'),
        extraFieldsTrigger = context.find('#show_extra_fields');
    
    // If the additional fields are hidden
    if (extraFields.is(':hidden')) {
        // Disable the submit button
        submitButton.attr('disabled', 'disabled');
    }
    
    // If the submit button is disabled
    if (submitButton.is(':disabled')) {
    
        // Listen on keypress events
        $(document).keypress(function(event) {
            // On pressing enter
            if (event.which == 13) {
                // Show the extra fields
                extraFields.show();
            }
    
            // Enable the submit button
            submitButton.removeAttr('disabled');
        });
    }
    
    // If the Next button has been pressed
    extraFieldsTrigger.on('click', function(event) {
        // Enable the submit button
        submitButton.removeAttr('disabled');
    });

    Thread Starter Madyson

    (@madyonhope1998)

    That has now worked thank you very much for your help

Viewing 5 replies - 16 through 20 (of 20 total)
  • The topic ‘Pressing Enter & Clicking the 'Next' button’ is closed to new replies.