Announcement

Collapse
No announcement yet.

Submit on "enter" - Gift Registry access

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • #16
    i'm going to guess you don't have an onReady script block so just add it at the bottom of your page. and yes you can put it on the html template file you are referring to.

    you can copy and paste this in the footer (I corrected my bonehead syntax error from before) and it should work for you.

    Code:
    <script>
    jQuery(document).ready(function(){
       jQuery('input[name="txtRegPassword"]').on("keyup", function(evt){
          if(jQuery(this).value.length >=0){
               if(evt.keyCode == 13 || evt.keyCode == 169){
                  document.frmForm.submit();
               }
          }
       });
    });
    </script>
    the document.ready function will only run once the dom is completely loaded but much faster than we as humans can react to the page. This will ensure the listener is in place when it needs to be but not too soon.

    as a rule of thumb, any non-essential javascript you write should always go at the end of the page after the html. If you NEED something to run as the page is loading.. move it up the DOM

    Comment

    Working...
    X