All Questions

2515
votes
9answers
700017 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. e...
278
votes
11answers
86229 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() { ...
126
votes
6answers
52009 views

What is DOM Event delegation?

Can anyone please explain event delegation in JavaScript and how is it useful?
26
votes
7answers
15216 views

onclick="" vs event handler

If I want a function to be executed, I prefer doing inline js: <p id="element" onclick="doSomething();">Click me</p> because it is easier to debug. However, I hear people saying not to...
243
votes
3answers
293877 views

How can I trigger an onchange event manually?

I'm setting a date-time textfield value via a calendar widget. Obviously, the calendar widget does something like this : document.getElementById('datetimetext').value = date_value; What I want is :...
9
votes
2answers
1858 views

Why calling setState method doesn't mutate the state immediately?

Ok, i'll try and make this quick because it SHOULD be an easy fix... I've read a bunch of similar questions, and the answer seems to be quite obvious. Nothing I would ever have to look up in the firs...
586
votes
16answers
228903 views

How to debug JavaScript/jQuery event bindings with Firebug (or similar tool)

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 simp...
430
votes
18answers
264423 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 textFie...
154
votes
4answers
21013 views

Do event handlers stop garbage collection from occurring?

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 ...
4
votes
3answers
16152 views

How to make an image move while listening to a keypress in Java.

I'm starting to learn java programming and I think it's cool to learn java through game development. I know how to draw image and listen to a keypress then move that image. But is it possible to make ...

Previous Next