![]() Once any key is pressed down inside the input field, the background color changes to blue as shown in the below screenshot.At this point in time, no activity has been performed.The below screenshot is taken when the page is first loaded in the browser. ![]() In a similar mannner, once the key is released, keyup event gets triggered which invokes keyup() method to execute the attached function to chnage the background color of the input field. The reason behind this is when any key is pressed down, keydown event gets triggered which invokes keydown() method to execute the attached function to change the background color of the input field. As soon as you release the key, the background color changes to teal. Once you press any key inside the input field, the background color will change to skyblue. $("input").css("background-color", "teal") Įxample for jQuery keyup event Enter anything: Let us now see an example illustrating the order of events keydown() and keyup(). In the above example, we saw that as soon as the key is released, the keyup event is triggered which in turn executes the attached function that changes the background color.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |