Getting Started with Adobe After Effects - Part 6: Motion Blur


Upload Image Close it
Select File

Learning is a never ending thing and just one life is not enough to learn all the things you want to learn. The ocean of knowledge is very, very deep. This blog has been created for the same objective. I write on things which I come across in my daily life and feel to share it with the people across the world. The blog publish articles on SQL Server, SSIS 2005, SSIS 2008 alongwith other useful stuff which are good to know for the professional life.
Browse by Tags · View All
Google SpreadSheet API 12
YouTube API with .NET 7
PEGA Tutorials 6
PRPC Tutorials 6
Google BigQuery 6
Google Analytics API in .NET 6
Google Cloud Services 5
Core Reporting API with C# 4
Good Data API with Picasa 4
Ms-Excel function 4

Archive · View All
June 2012 17
October 2012 12
May 2012 12
August 2012 11
March 2013 10
July 2012 10
December 2011 9
January 2012 7
September 2012 6
February 2012 6

SinghVikash Blog

What are JQuery Events?

Jun 15 2012 12:00AM by Vikash Kumar Singh   

Technically Events are methods. These methods are fired/triggered/executed automatically when an interaction took place. This interaction could be user initiated (clicking on a button) or system initiated (for example when document is ready for client browser, the ready event is fire).

Let us try to understand Jquery events from a very basic example. Consider we have following elements in our web page - two paragraphs and a link.

We will write a Jquery event for paragraph which will change the paragraph background color once user click on it.

<HTML>
<HEAD>
<script src="http://code.jquery.com/jquery-latest.js"></script>
</HEAD>
<BODY>
<P>This is a paragraph. Clicking on this paragraph will change its color.</P>
<P><A href="http://www.singhvikash.in">Click to visit www.singhvikash.in</A></P>
<script>
$("p").click(function(){
$(this).css("background-color","yellow");
}
);
</script>
</BODY>
</HTML>

After clicking on the paragraph in web browser the background color did changed.

JQuery Events are different from JavaScript Events. I would say the Jquery events are more intelligent than JavaScript events. Why? The reason is that if we have a web page and JavaScript events into it the JavaScript events will be applied to only those DOM elements which were loaded along with JavaScript code in the browser. Any Page element added/removed after loading of pages will throw errors and will not be recognized.

Jquery does not have this limitation. Any page element added after loading the page will be recognized by the Jquery events.

So what events are available with Jquery?

Jquery has provided a rich set of events which can be used on the web pages. The events can be categorized into following:

1. Mouse Events
2. Keyboard Events
3. Browser Events
4. DOM Element Events
5. Ajax Events

For a list of events you can visit: http://www.jquery4u.com/events/jquery-list-events-bind/

An event method can be used for multiple events. For example if we want to use the same event method for two different events we can use it in JQuery with simplicity:

<script>
$("p").bind("click mouseenter", function(){$(this).css("background-color","yellow")});
$("p").bind("mouseleave", function(){$(this).css("background-color","white")});
</script>

As you can see from the code the background color of the paragraph will change on two events; first when user click on the paragraph and second when the mouse enter on the paragraph.

One of the interesting things, JQuery has to offer are you can attach an event and event method with any DOM element/web page element. So for example if we have following HTML output:

<BODY>
<P>This is a paragraph. <Font color="red" id="myID">Clicking on this paragraph</FONT> will change its color.</P>
<P><A href="http://www.singhvikash.in">Click to visit www.singhvikash.in</A></P>
</BODY>

We can bind an event and event handler with the element FONT in JQuery like this:

<script>
$("#myID").bind("click", function(){$(this).css("background-color","pink")});
</script>

JQuery has provided a good set of events; it is up to us to explore and use it in our web development.

Thanks! for reading till this point


Republished from Blog by Vikash Kumar Singh [46 clicks].  Read the original version here [0 clicks].

Vikash Kumar Singh
279 · 0% · 152
1
 
0
Lifesaver
 
0
Refreshed
 
0
Learned
 
0
Incorrect



Submit

Your Comment


Sign Up or Login to post a comment.

"What are JQuery Events?" rated 5 out of 5 by 1 readers
What are JQuery Events? , 5.0 out of 5 based on 1 ratings
    Copyright © Rivera Informatic Private Ltd Contact us      Privacy Policy      Terms of use      Report Abuse      Advertising      [ZULU1097]