Take the 2-minute tour ×
Stack Apps is a question and answer site for apps, scripts, and development with the Stack Exchange API. It's 100% free, no registration required.


This user script disables the default behavior of the enter key submitting a comment. With this script installed, you must explicitly click the Add Comment button to submit your comment.


If you have Firefox+GreaseMonkey, Opera, or Google Chrome, try this GreaseMonkey script that will disable enter in comments.

// ==UserScript==
// @name           Disable Enter key on comments on Stack Exchange.
// @namespace      http://networkpx.googlecode.com
// @description    Disable Enter key on comments on Stack Exchange.
// @include        http://*.stackexchange.com/*
// @include        http://stackoverflow.com/*
// @include        http://meta.stackoverflow.com/*
// @include        http://serverfault.com/*
// @include        http://meta.serverfault.com/*
// @include        http://superuser.com/*
// @include        http://meta.superuser.com/*
// @include        http://askubuntu.com/*
// @include        http://meta.askubuntu.com/*
// ==/UserScript==

var s = document.createElement("script");
    s.innerHTML = '$(document).delegate(".comments-link, .comment-edit", "click", function(e) { \
  var events = $(this).closest("td").find("textarea[name=comment]").data("events"); \
  var makeShift = { handler: function(e) { e.shiftKey = true; } }; \
  events.keyup.splice(0, 0, makeShift); \
  events.keypress.splice(0, 0, makeShift); \


Click here to download this script.

See the script info page for step-by-step install instructions


share|improve this question
P.S. This works on Firefox with GreaseMonkey - I tested it. –  Nathan Osman Feb 17 '11 at 19:26
@Nick: Thanks, now it also prevents the Enter key from posting the comment while editing too! –  Tsuyoshi Ito Jun 7 '11 at 18:43
please you didn't include stackapps in your script. –  Mhmd Mar 17 at 18:17
I've a weird issue with this on Chrome 35. When this script is enabled and I click "add comment", nothing happens except going to the top of the page...I don't see why that should happen. Any thoughts? –  Rody Oldenhuis Jun 13 at 14:33

You must log in to answer this question.

Browse other questions tagged .