- 5 years ago
- Zaid Bin Khalid
- 3,483 Views
-
4
In this session, you will learn how to handle events with jQuery with the help of an example.
What are Events
Event is an object in Javascript that is used to created or something changes in graphical by the user, Like when a button or a link is clicked, the text is entered or typed into an input box or text area, the selection is made in a select box, the key is pressed on the keyboard, the mouse pointer is moved, etc.
jQuery provide the basic enhances event-handling by offering the events methods for most browser events, some of these method are ready ( ) method, click ( ) method, keypress( ) method, focus ( ) method, blur ( ) method, change ( ) method, etc. For example,
<script>
$(document).ready(function(){
// Code to be executed
alert("Hello World!");
});
</script>
Events Categorized:
The event categorized divided into four main groups:
- Mouse Events.
- Keyboard events.
- Form events.
- Document/window events.
The mention below section will give you an overview of all these events as well as related jQuery methods one by one.
Mouse Events:
When the user clicks some element, move the mouse pointer, etc. A mouse event is fired. Mention below is some commonly used jQuery methods to handle the mouse events.
Keyboard Events
When the user presses or releases a key on the keyboard, a keyboard event is fired. Mention below is a commonly used jQuery method to handle the keyboard events.
Form Events
When a form control receives or loses focus or when the user modifies or specified a form control value such as by typing text in a text input, select an option in a select box, etc. a form event is fired. Mention below is commonly used jQuery methods to handle the form events.
Document/Window Events
When the page DOM (Document Object Model) is ready or when the user resizes or scrolls the browser window, etc. Document/window Event is fired. Mention below is commonly used jQuery methods to handle such kind of events.
- 5 years ago
- Zaid Bin Khalid
- 3,483 Views
-
4