0

I just need to auto clicked F11 when my page is load in Jquery.

Below code is working when i press F11, but i need to auto press F11.

$(document).keyup(function(e){
        if(e.which==122){
            e.preventDefault();
            alert('F11 pressed');
            return false;
        }
    });
claudios
  • 6,588
  • 8
  • 47
  • 90
HarryDev
  • 61
  • 2
  • 12

1 Answers1

0

Run a function and add a Event of trigger in this it will help You. Check my Code Also see Live Demo:- https://jsfiddle.net/Arsh_kalsi01/12L32q3x/2/

PressButton();
function PressButton()
{
    var e = $.Event( "keypress", { which: 122 } );
    $(document).trigger(e);
    if(e.which==122){
      e.preventDefault();
      alert('F11 pressed');
      return false;
    }
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
Arsh Kalsi
  • 179
  • 1
  • 10