jquery-tabledit icon indicating copy to clipboard operation
jquery-tabledit copied to clipboard

How to prevent enter key?

Open neverender24 opened this issue 7 years ago • 3 comments

Are there any ways to prevent user from pressing enter to trigger event when using buttons? Instead just click the buttons .

neverender24 avatar Mar 02 '18 01:03 neverender24

In the jquery-tabledit.js, just remove or comment out the case 13 inside the keyup function

$(document).on('keyup', function (event) {
            // Get input element with focus or confirmation button.
            var $input = $table.find('.tabledit-input:visible');
            var $button = $table.find('.tabledit-confirm-button');

            if ($input.length > 0) {
                var $td = $input.parents('td');
            } else if ($button.length > 0) {
                var $td = $button.parents('td');
            } else {
                return;
            }

            // Key?
            switch (event.keyCode) {
                case 9:  // Tab.
                    if (!settings.editButton) {
                        Edit.submit($td);
                        Mode.edit($td.closest('td').next());
                    }
                    break;
            //case 13: // Enter.
            //    Edit.submit($td);
            //    break;
                case 27: // Escape.
                    Edit.reset($td);
                    Delete.reset($td);
                    break;
            }
        });

        return this;
    };

NST77 avatar Apr 17 '18 11:04 NST77

I already commented on that line that you put and it still does not work, do you have another solution?

luissegovia avatar Sep 08 '20 21:09 luissegovia

just commented /*case 13:b.submit(a);break;*/ it worked. (mine was v.1.2.3 minified)

rs2pt avatar Dec 16 '21 17:12 rs2pt