As you may already know, there are quite a few mouse events, keyboard events, browser events, DOM element events etc that you can capture with JavaScript and then use some jQuery to perform actions based on the event fired using bind(), live() or such. Here is a list of the main events which you should be aware of.

blur, focus, focusin, focusout, load, resize, scroll, unload, click, dblclick, mousedown, mouseup, mousemove, mouseover, mouseout, mouseenter, mouseleave, change, select, submit, keydown, keypress, keyup, error

Mouse Events

scroll, click, dblclick, mousedown, mouseup, mousemove, mouseover, mouseout, mouseenter, mouseleave, load, resize, scroll, unload, error,

Example Usage

(function($) 
{

	$(document).ready(function()
	{
		$('#id).bind('click', function(e)
		{
			//mouse event fired (element clicked)
		});
	});
	
})(jQuery);

Keyboard Events

keydown, keypress, keyup

Example Usage

(function($) 
{

	$(document).ready(function()
	{
		$(document).bind('keypress', function(e)
		{
			//keyboard event fired
		});
	});
	
})(jQuery);

Browser Events

load, resize, scroll, unload, error

Example Usage

(function($) 
{

	$(document).ready(function()
	{
		//browser event fired (document object model loaded)
	});
	
})(jQuery);

DOM Element Events

blur, focus, focusin, focusout, change, select, submit

Example Usage

(function($) 
{

	$(document).ready(function()
	{
		$('#id).bind('blur', function(e)
		{
			//dom event fired (input focus)
		});
	});
	
})(jQuery);

Demo

See: Find the Keycode of Keyboard Key Pressed

Sam Deering is a Front-end Web Developer who specialises in JavaScript & jQuery. Sam is driven and passionate about sharing his knowledge to educate others.

Free Guide:

How to Choose the Right Charting Library for Your Application

How do you make sure that the charting library you choose has everything you need? Sign up to receive this detailed guide from FusionCharts, which explores all the factors you need to consider before making the decision.


Learn JavaScript for free!
Free course: Introduction to JavaScript

Yours when you take up a free 14-day SitePoint Premium trial.