HTML | Firing submit button

Problem
Editing one or multiple textboxes in a page won't execute the correct button in the form.  

Solution
Once we make sure our button, textboxes, and others, are wrapped within a "Form" tag, various things will work right away.
- Hitting the "Enter" key will fire the first available button with "submit" type
- Textbox values will be available by the receiving event handler of the POST
- If various submit buttons exist, we may need to tell each textbox, which button should be fired when we hit enter on it

    

        // button action on input enter 
        $('input').keypress(function (e) {
            if (e.which == 13) {
                e.preventDefault();
                $(this).next().trigger('click');
            }
        });

Comments

Popular posts from this blog

Breaking down document locking in SharePoint

Working around X-Frame-Options for iframes

Document ID not being generated