jQuery Events Handlers Methods for ASP.NET Applications
jQuery event handler methods add or remove event handlers from selected form elements. For example:
$(selector).bind(event)
| Method | Format | Example | Description |
bind | $(selector).bind(event) | $('#txtBind1').bind('mouseover', function () { $("#txtBind1").css("background-color", "#DEB887"); }); $('#txtBind1').bind('mouseleave', function () { $("#txtBind1").css("background-color", "#CD853F"); }); | This handler method is the main way developers can attach behavior to a document for all jQuery event types. The example binds the mouseover and mouseleave background color change to every textbox on the ASP.NET form. |
| unbind | $(selector).unbind(event) | function UnbindMouseLeave() { $('("#txtBind1).unbind('mouseleave'); } | This handler method allows developers to unattach behavior to a document for all jQuery event types. The example unbinds the mouseover background color change from every textbox on the ASP.NET form when function called. |
| live | $(selector).live(event type, handler) OR $(selector).live(event type, event data, handler) | $("#Label1").live("mouseover", function () { alert('live event handler method'); }); | The live handler method attaches a handler to a jQuery event for the elements matching the selector to the "eventType" string containing a event type, such as "click" or "mouseover." With jQuery 1.4 the event string can contain multiple, space-separated event types or custom programmer events. The "eventData" string is data that will be passed to the event handler. The "handler" string is a function to run when the event is triggered. |
| die | $(selector).die() OR $(selector).die(event type, handler) | | Unbind all event handlers attached using "live" from the page elements. eventTypeA string containing a JavaScript event type, such as click or keydown. handlerThe function that is to be no longer executed. |
| | | | |