Navigation

    APPDRAG Community

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Popular

    REMINDER

    Please be respectful of all AppDragers! Keep it really civil so that we can make the AppDrag community of builders as embracing, positive and inspiring as possible.

    TIP: Trigger button click on enter

    General Discussion
    2
    4
    144
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Dick Honing
      Dick Honing last edited by

      I would like to trigger the login button when a user clicks on the enter key in a password field.

      I found the following code on w3schools:

      var input = document.getElementById("passwordField");
      
      
      
          // Execute a function when the user releases a key on the keyboard
      
          input.addEventListener("keyup", function(event) {
      
              // Number 13 is the "Enter" key on the keyboard
      
              if (event.keyCode === 13) {
      
                  // Cancel the default action, if needed
      
                  event.preventDefault();
      
                  // Trigger the button element with a click
      
                  document.getElementById("loginButton").click();
      
              }
      
          });
      

      Don't forget to specify the id's for the password field and login button, in this case 'passwordField' and 'loginButton'

      click button when user clicks enter key in input field(s) ... or something similar 😉

      1 Reply Last reply Reply Quote 0
      • Dick Honing
        Dick Honing last edited by

        link to w3shools 'How TO' page ... https://www.w3schools.com/howto/howto_js_trigger_button_enter.asp

        1 Reply Last reply Reply Quote 0
        • Wassim
          Wassim last edited by

          Hi again,

          I'm not sure, is it a feature request for Cloud Backend Inputs?

          1 Reply Last reply Reply Quote 0
          • Dick Honing
            Dick Honing last edited by

            @Wassim perhaps it's an idea, but that's up to you and the number of users this might be useful to ...

            1 Reply Last reply Reply Quote 0
            • First post
              Last post