I have a textbox field with id="textbox1"
. How do I set its value?
This is what I tried:
query('#textbox1').text = 'test 123';
But it did not work.
InputElement input = querySelector("#textbox1");
input.value = "test123";
Tips : When you use querySelector(selector)
you can type the result with what you expect (a InputElement
here). Thus, editor will provide content assist to help you.
Note that query
is now deprecated. For all those that find this through Google as I did, here is updated
InputElement input = querySelector("#textbox1");
input.value = "test123";
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With