Friday, January 28, 2011
JQuery Events - Example
Request from Visitors:
The name of the event says when it will be triggered.
Some of you had asked me how to use jQuery Events. Thus, I am writing this post.
JQuery Events:
JQuery Events:
•
- $(“#id”).change(….
- $(“a”).click(….
- $(“a”).hover(….
Other Events
focusin, focusout, keydown, keyup, scroll, select, submit
The name of the event says when it will be triggered.
Example for JQuery Events
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Example - Events</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js" type="text/javascript"></script>
<script language="javascript">
$(document).ready(function(){
$('#hide').click(function(element){
$('#hide').attr("disabled","disabled");
//<input id="hide" type="button" value="Hide" disabled="disabled"/>
$('#paragraph').slideUp('slow');
});
});
</script>
</head>
<body>
<input id="hide" type="button" value="Hide" />
<div id="paragraph">
This is a paragraph. This is a paragraph. This is a paragraph. This is a paragraph. This is a paragraph. This is a paragraph. This is a paragraph. This is a paragraph. This is a paragraph. This is a paragraph.
</div>
</body>
</html>
For further reference: http://api.jquery.com/category/events/
•
•
Subscribe to:
Post Comments
(
Atom
)
No comments :
Post a Comment