Change "Enter" button functionality on Create Member popup

The following idea was submitted by Jordan:


Currently, when pressing the "Enter" button on a keyboard while creating a Member, it closes the dialogue. Make the enter button choose the "create" button instead.

This was a major frustration for me in many other places as well. I solved it by simply disabling the enter key on all of MemberMouse's popups.


If you'd like to try this, add the following to your theme or plugin JavaScript:


(function($) {
  $(window).load(function() {

      // Wait for the MemberMouse form container element, then attach events.
      function UIDialogAttachBehaviors () {
        var onMMFormContainer = setInterval(function() {
        
          if ($('#mm-form-container').length) {
            clearInterval(onMMFormContainer);
            
            var UIDialog = $('.ui-dialog');

            /**
             * Prevent enter keystrokes from closing popup dialogs.
             */
            UIDialog.find('input, select').keydown(function(e) {
              if (e.which === 13) {
                return false;
              }
            });

          }

        }, 200);
      }

  });
})(jQuery);


(I did this on the user-facing pages and not the admin, but it should work the same.)


Login or Signup to post a comment