diff options
author | Jörn Zaefferer <joern.zaefferer@gmail.com> | 2006-09-09 08:31:07 +0000 |
---|---|---|
committer | Jörn Zaefferer <joern.zaefferer@gmail.com> | 2006-09-09 08:31:07 +0000 |
commit | 998d1d8839813b957a32465fdc7ef7d27d858eea (patch) | |
tree | f9d28e8c9e60eca152be166dc23ce7686b9338c1 /src | |
parent | 698eafb58a9b046446115be7d8a9d4a6db7ececb (diff) | |
download | jquery-998d1d8839813b957a32465fdc7ef7d27d858eea.tar.gz jquery-998d1d8839813b957a32465fdc7ef7d27d858eea.zip |
Fixed documentation for bind(String, Function)
Diffstat (limited to 'src')
-rw-r--r-- | src/jquery/jquery.js | 31 |
1 files changed, 19 insertions, 12 deletions
diff --git a/src/jquery/jquery.js b/src/jquery/jquery.js index d2141375e..f997aafa4 100644 --- a/src/jquery/jquery.js +++ b/src/jquery/jquery.js @@ -3158,24 +3158,31 @@ jQuery.macros = { }, /** - * Binds a particular event (like click) to a each of a set of match elements. - * - * @example $("p").bind( "click", function() { alert("Hello"); } ) + * Binds a handler to a particular event (like click) for each matched element. + * The event handler is passed an event object that you can use to prevent + * default behaviour. To stop both default action and event bubbling, your handler + * has to return false. + * + * @example $("p").bind( "click", function() { + * alert( $(this).text() ); + * } ) * @before <p>Hello</p> - * @result [ <p>Hello</p> ] - * - * Cancel a default action and prevent it from bubbling by returning false - * from your function. + * @result Hello * * @example $("form").bind( "submit", function() { return false; } ) + * @desc Cancel a default action and prevent it from bubbling by returning false + * from your function. * - * Cancel a default action by using the preventDefault method. - * - * @example $("form").bind( "submit", function() { e.preventDefault(); } ) + * @example $("form").bind( "submit", function(event) { + * event.preventDefault(); + * } ); + * @desc Cancel only the default action by using the preventDefault method. * - * Stop an event from bubbling by using the stopPropogation method. * - * @example $("form").bind( "submit", function() { e.stopPropogation(); } ) + * @example $("form").bind( "submit", function(event) { + * event.stopPropagation(); + * } ) + * @desc Stop only an event from bubbling by using the stopPropagation method. * * @name bind * @type jQuery |