Event handling is a coding style about handling messages between a source and one or more subscribers. A point listener in the source provide a way which subscribed code can consume messages raised from the source.

learn more… | top users | synonyms (4)

686
votes
8answers
160k views

event.preventDefault() vs. return false

When I want to prevent other event handlers from executing after a certain event is fired, I can use one of two techniques. I'll use jQuery in the examples, but this applies to plain-JS as well: #1 ...
347
votes
15answers
141k views

How to debug Javascript/jQuery event bindings with FireBug (or similar tool) [closed]

I need to debug a web application that uses jQuery to do some fairly complex and messy DOM manipulation. At one point, some of the events that were bound to particular elements, are not fired and ...
78
votes
4answers
8k views

Do event handlers stop garbage collection from occuring?

If I have the following code: MyClass pClass = new MyClass(); pClass.MyEvent += MyFunction; pClass = null; Will pClass be garbage collected? Or will it hang around still firing its events whenever ...
72
votes
7answers
28k views

jQuery: $().click(fn) vs. $().bind('click',fn);

When using jQuery to hookup an event handler, is there any difference between using the click method $().click(fn) versus using the bind method $().bind('click',fn); Other than bind's optional ...
62
votes
7answers
59k views

jQuery equivalent of JavaScript's addEventListener method

I'm trying to find the jQuery equivalent of this JavaScript method call: document.addEventListener('click', select_element, true); I've gotten as far as: $(document).click(select_element); but ...
59
votes
1answer
15k views

C#: How to remove a lambda event handler [duplicate]

Possible Duplicates: Unsubscribe anonymous method in C# How do I Unregister ‘anonymous’ event handler I recently discovered that I can use lambdas to create simple event ...
57
votes
2answers
17k views

Is it necessary to explicitly remove event handlers in C#

I have a class that offers up a few events. That class is declared globally but not instanced upon that global declaration--it's instanced on an as-needed basis in the methods that need it. Each ...
50
votes
3answers
37k views

How do you handle oncut, oncopy, and onpaste in jQuery?

The jQuery documentation says the library has built-in support for the following events: blur, focus, load, resize, scroll, unload, click, dblclick, mousedown, mouseup, mousemove, mouseover, mouseout, ...
49
votes
5answers
32k views

extjs 4 event handling tutorial [closed]

I've recently started learning ExtJS, I'm looking for a good ExtJS 4 event handling tutorial. I have no experience of any previous versions of ExtJS. From reading various manuals, guides and ...
47
votes
6answers
50k views

Understanding events and event handlers in C#

I understand the purpose of events, especially within the context of creating user interfaces. I think this is the prototype for creating an event: public void EventName(object sender, EventArgs e); ...
47
votes
8answers
20k views

Event system in Python

What event system for Python do you use? I'm already aware of pydispatcher, but I was wondering what else can be found, or is commonly used? I'm not interested in event managers that are part of ...
42
votes
6answers
21k views

Handle URL anchor change event in js

How can I write the JavaScript callback code that will be executed on any changes in the URL anchor? For example from http://example.com#a to http://example.com#b
38
votes
5answers
28k views

UITextField text change event

How can I detect any text changes in a textField? The delegate method shouldChangeCharactersInRange works for something, but it did not fulfill my need exactly. Since until it returns YES, the ...
38
votes
8answers
8k views

Why are only final variables accessible in anonymous class?

a can only be final here. Why? How can I reassign a in onClick() method without keeping it as private member? private void f(Button b, final int a){ b.addClickHandler(new ClickHandler() { ...
36
votes
3answers
6k views

C#: Difference between ' += anEvent' and ' += new EventHandler(anEvent)'

Take the below code: private void anEvent(object sender, EventArgs e) { //some code } What is the difference between the following ? [object].[event] += anEvent; //and [object].[event] += ...

1 2 3 4 5 311
15 30 50 per page