ClickHandler on an existing element in GWT

gwt

Solution

If you're trying to add a `ClickHandler` to a `<button>`, you can do that with `Button.wrap()`.

For an `<a>` yo can use `Anchor.wrap()` (`Anchor`s only have `ClickListener`s, not `ClickHandler`s...yet)

For a `<div>` you can use `Label.wrap()` (`Label`s are just `<div>`s).

Problem

I have an HTML document. In that document, there is an element (like button, div, a) with an ID. I know I can use: ``` Document.get().getElementById("id"); ``` to find the required element in the HTML file. How can I add a Click handler to it? ClickHandlers only seem to be available on the Button class. Thanks

Original source