Jump to content

User:Majesty of the Commons/StopEnterPublishing.js

From Wikipedia, the free encyclopedia
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
// Prevent a press of the Enter key when focus is in either the "Edit Summary" text box
// or the "This is a minor edit" or "Watch this page" checkboxes from publishing an edit.
//
//
$(function () {
  $('#editform').keydown(function(e) {
    if (e.which == 13 && e.target.type !== 'textarea' && e.target.nodeName === 'INPUT')
    	e.preventDefault();
  });
});