javascript - How do I distinguish between a mouse click and space bar click in jquery? -


i have jquery-ui dialog box cancel button closes dialog. in dialog box there page generates string, , sends java end. string contains spaces. jquery interpreting spaces click, causing popup close before should. how make event cancel button gets fired on mouse click, , not space bar?

code:

 $('<div id="popup">').dialog({                     autoopen: false,                     modal: true,                     buttons: {                       "cancel" : {                             text: "cancel",                             id: "cancelbutton",                             click: function(){                             $('#popup').html('');                             $('#popup').dialog('close');                             }                            },                      }                 }); var close = function (event, ui) {             $('#popup').unbind("dialogclose", close);                     //reload page                 };             $('#popup').on("dialogclose", close);              $('#popup').load("index.html").dialog('open'); 


Comments

Popular posts from this blog

php - SPIP: From Tag directly to an article -

jquery - isAjaxRequest always return false -

ruby on rails - In a controller spec, how to find a specific tag in the generated view? -