'How to get the value out of a GWT HTML element?
my problem is, that there are now slider elements inside GWT, so i tryed using an HTML element to work araound that problem:
HTML slider = new HTML(
"<input type=\"range\" name=\"historyRange\" min=\"-960\" max=\"960\" value=\"0\" class=\"slider\" id=\"counter\" oninput=\"this.form.historyRange.value=this.value\" />"
);
So now i only needed the value out of that slider. I tried
String test = DOM.getElementAttribute(slider.getElement(), "value");
and the same with StyleAttribute, but no luck. I tried to get the Element by ID with
String test = Document.get().getElementById("counter").getAttribute("value");
but no luck either.
I'm out of ideas here, how i can make this thing work.
Kiouri.sliderbar and Smart GWT are no options for my problem.
(termurin-11 and JetBrains GWT Plugin 221.5080.56)
Solution 1:[1]
GWT does not directly support <input type='range' /> elements, but it has a generic <input /> element support: InputElement.
You can cast your slider element to an InputElement this way:
InputElement input = InputElement.as(Document.get().getElementById("counter"));
To get the value just call:
input.getValue();
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Adam |
