This post will give you example of disable f5 button using javascript. Here you will learn disable f5 key using javascript. i would like to share with you prevent f5 refresh jquery. i would like to share with you disable f5 button using javascript. Follow bellow tutorial step of disable f5 key press in javascript.
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:
<!DOCTYPE html>
<html>
<head>
<title>How to disable f5 refresh button using jquery? - HDTuto.com</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.0/jquery.min.js"></script>
</head>
<body>
<div class="container">
<h1>How to disable f5 refresh button using jquery? - HDTuto.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...
Do you like below Tutorials ?
- PHP Laravel 5.5 - import export data into excel and csv using maatwebsite
- Laravel 7.x and 6.x create custom facade example from scratch
- Node JS - Get Real time online users counter using socket io example
- PHP Laravel 7.x and 6.x - Bootstrap Admin Theme Integration example from scratch
- MySQL Query - How to select records of today to next Sunday ?
- Laravel 7.x and 6.x - username custom validation example
- Laravel 5.5 - Import Extract zip file using chumper/zipper package
- PHP Laravel Set Custom Validation Error Messages Example