From 469a77d74c407919d5c76f6a7c49457e6833849b Mon Sep 17 00:00:00 2001 From: Andrew Nacin Date: Mon, 24 Sep 2012 16:25:15 +0000 Subject: [PATCH] Hitting return when adding a new category from the category meta box should add the new category, not submit the post form. props wojtek.szkutnik, fixes #14312. git-svn-id: http://core.svn.wordpress.org/trunk@21970 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/js/post.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/wp-admin/js/post.js b/wp-admin/js/post.js index 49aec1904a..459054e5a9 100644 --- a/wp-admin/js/post.js +++ b/wp-admin/js/post.js @@ -299,6 +299,13 @@ jQuery(document).ready( function($) { // Ajax Cat $('#new' + taxonomy).one( 'focus', function() { $(this).val( '' ).removeClass( 'form-input-tip' ) } ); + + $('#new' + taxonomy).keypress( function(event){ + if( 13 === event.keyCode ) { + event.preventDefault(); + $('#' + taxonomy + '-add-submit').click(); + } + }); $('#' + taxonomy + '-add-submit').click( function(){ $('#new' + taxonomy).focus(); }); syncChecks = function() {