Does anybody know how to make a Popover close by pressing the escape button? | XM Community
Skip to main content
Curious if anybody knows how to make a Popover window close by pressing the escape button for Website / App feedback.

Thanks!
Hello @Nash9392

Try this if it help..

$('#example').popover();

$(document).keyup(function (event) {
if (event.which === 27) {
$('#example').popover('hide');
}
});
Hello @Nash9392 ,

Add this java script code to the question implementing popover



Event.observe(document,'keydown',function(e){
if (e.keyCode == 27) // if esc was pressed
{
//add display:none css to popover
}

Note: please give your popover code, so that I can give commented part of the above code i.e changing css using js

Leave a Reply