Does anybody know how to make a Popover close by pressing the escape button? | XM Community
Solved

Does anybody know how to make a Popover close by pressing the escape button?

  • 7 August 2018
  • 2 replies
  • 86 views

Curious if anybody knows how to make a Popover window close by pressing the escape button for Website / App feedback.

Thanks!
icon

Best answer by SaurabhPujare_Ugam 7 August 2018, 23:15

View original

2 replies

Userlevel 6
Badge +18
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