jQuery Tutorial
Event | Description |
---|---|
click() | click |
keydown() | key down |
keypress() | key press |
keyup() | keyup |
mouseover() | mouse over |
mouseout() | mouse out |
mouseenter() | mouse enter |
mouseleave() | mouse leave |
scroll() | scroll |
focus() | focus |
blur() | blur |
resize() | resize |
bind( eventType [, eventData ], handler )
<html> <head> <title>The jQuery Example</title> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <script type = "text/javascript"> $(document).ready(function(){ $("a:first").bind("click", function(event){ $("p:first").text("Welcome to jQuery Events!"); }); }); </script> </head> <body> <a href="#">webpage link.</a> <p></p> </body> </html>Output:
webpage link. // once cliked webpage link, below message appears. Welcome to jQuery Events!
unbind(eventType, handler) or unbind(eventType)
<html> <head> <title>The jQuery Example</title> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <script type = "text/javascript"> $(document).ready(function() { $("div:first").bind('click', function( event ){ $("p:first").html("Event type is " + event.type +"<br/> page(X, Y) : (" + event.pageX + "," + event.pageY+")<br/>Target : " + event.target.innerHTML); }); }); </script> </head> <body> <div>main div content.</div> <p></p> </body> </html>Output:
main div content. //once clicked above, below info appears. Event type is click page(X, Y) : (135,17) Target : main div content.
$("div:first").click();
$("div").click(function(){ // actions need to written here. alert("Welcome to jQuery Events!"); });
<html> <head> <title>The jQuery Example</title> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <script type = "text/javascript"> $(document).ready(function() { $("div:first").hover(function(event){ alert("mouse hover!"); }, function(event) { $("p:first").html("Event type is " + event.type +"<br/> page(X, Y) : (" + event.pageX + "," + event.pageY+")<br/>Target : " + event.target.innerHTML); }); }); $("p").click(); </script> </head> <body> <div>main div content.</div> <p></p> </body> </html>Output:
$("#newDiv").mouseenter(function(){ alert("Enetered into new div!"); });
jQuery Tutorial
Privacy Policy | Copyright2020 - All Rights Reserved. | Contact us
| Report website issues in Github
| Facebook page
| Google+ page