Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I set the value of a textbox in Dart?

Tags:

dart

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.

like image 306
BraveNewMath Avatar asked Dec 19 '12 08:12

BraveNewMath


2 Answers

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.

like image 179
Alexandre Ardhuin Avatar answered Nov 20 '22 14:11

Alexandre Ardhuin


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";
like image 27
coryrwest Avatar answered Nov 20 '22 13:11

coryrwest