How to disable f5 refresh button using jquery?

How to disable f5 refresh button using jquery?

In this post we will give you information about How to disable f5 refresh button using jquery?. Hear we will give you detail about How to disable f5 refresh button using jquery?And how to use it also give you demo for it if it is necessary.

In this post, we will learn how to prevent or disable f5 refresh in javascript. sometime we does not want to browser refresh using f5 button for our web page. so you can disable f5 key in jquery. we can easily disable f5 button using javascript with example.

we will disable f5 key using keydown event of jquery. as we know f5 key code is a 116, so basically if user will press 116 event.keyCode then we will simply preventDefault with return false.

we can simply write this code:

$(document).ready(function() {

$(window).keydown(function(event){

if(event.keyCode == 116) {

event.preventDefault();

return false;

}

});

});

You can see bellow full example and demo file how it’s disabled f5 refresh button. let’s see code:

Example:

Also see:Add Edit Delete Table Row Example using JQuery

<!DOCTYPE html>

<html>

<head>

<title>How to disable f5 refresh button using jquery? - ItSolutionStuff.com</title>

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.0/jquery.min.js"></script>

</head>

<body>

<div >

<h1>How to disable f5 refresh button using jquery? - ItSolutionStuff.com</h1>

</div>

<script type="text/javascript">

$(document).ready(function() {

$(window).keydown(function(event){

if(event.keyCode == 116) {

event.preventDefault();

return false;

}

});

});

</script>

</body>

</html>

I hope it can help you…

Hope this code and post will helped you for implement How to disable f5 refresh button using jquery?. if you need any help or any feedback give it in comment section or you have good idea about this post you can give it comment section. Your comment will help us for help you more and improve us. we will give you this type of more interesting post in featured also so, For more interesting post and code Keep reading our blogs

For More Info See :: laravel And github

Leave a Comment

Your email address will not be published. Required fields are marked *

  +  78  =  85

We're accepting well-written guest posts and this is a great opportunity to collaborate : Contact US