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
Post a Comment