Voiding Click Events Implicitly With jQuery Plugin: voidClick()

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
	<title>jQuery Plugin For Code Short Cuts</title>
	<script type="text/javascript" src="jquery-1.3.2.js"></script>
	<script type="text/javascript">
 
 
		// This method acts just like binding a click-event; the
		// difference is that it cancels the default event
		// implicitly such that you don't have to in your method.
		jQuery.fn.voidClick = function( method ){
			// Bind a click event to each item in the collection.
			this.click(
				function(){
					// Execute given method callback in current
					// context as defined by jQuery.
					method.apply( this, arguments );
 
					// Cancel default event.
					return( false );
				}
				);
 
			// Return existing jquery collection for chaining.
			return( this );
		}
 
 
 
		// When the DOM is ready, initialize.
		$(function(){
 
			// Bind click event to link.
			$( "a" ).voidClick(
				function(){
					// Alert link HREF to test "this" context.
					alert( $( this ).attr( "href" ) );
				}
				);
 
		});
 
	</script>
</head>
<body>
 
	<h1>
		jQuery Plugin For Code Short Cuts
	</h1>
 
	<p>
		<a href="http://www.google.com">Navigate Away</a>!
	</p>
 
</body>
</html>

For Cut-and-Paste