jquery-tabledit
jquery-tabledit copied to clipboard
How to prevent enter key?
Are there any ways to prevent user from pressing enter to trigger event when using buttons? Instead just click the buttons .
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;
};
I already commented on that line that you put and it still does not work, do you have another solution?
just commented /*case 13:b.submit(a);break;*/
it worked. (mine was v.1.2.3 minified)