jQuery keydown()

The jQuery keydown() method is used to attach a function to run when a keydown event occurs i.e., when a key is pressed on the keyboard.


To trigger the keydown event for selected elements.


To add a function to the keydown event.



  • It is an optional parameter.
  • The function parameter specifies the function to run when the event occurs.


<!DOCTYPE html>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
$("input").css("background-color", "red");
Write something: <input type="text">
Please follow and like us:
Content Protection by DMCA.com