Write a jQuery code to detect whether the user has pressed 'Enter key' or not
Answer :
File Name : SP.html
<html>
<head>
<script src="https://code.jquery.com/jquery-3.6.0.js" integrity="sha256-H+K7U5CnXl1h5ywQfKtSj8PCmoN9aaq30gDh27Xc0jk=" crossorigin="anonymous"></script>
<title>SP Creation</title>
</head>
<body>
<div class="container">
<div class="text" id="box">
<h2>Text Box</h2>
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit. Odio, quas?</p>
</div>
</div>
<script>
$(document).ready(function(){
$('body').keypress(function(){
swal('Key Press...!');
});
});
</script>
<script src="https://unpkg.com/sweetalert/dist/sweetalert.min.js"></script>
</body>
</html>
Write a jQuery code to detect whether the user has pressed 'Enter key' or not
Reviewed by technical_saurabh
on
April 29, 2021
Rating:
No comments:
Post a Comment