Unable to get text from text area

I can not get the text from my text box:

Very simple text area:

<textarea id="message" placeholder="Type your text here..."></textarea> 

My dart code is:

 var area = document.query('#message'); document.query("#send").on.click.add((e) { print('send ${area.text}'); }); 

When I write a message in the field and click send, just show:

 send 

I do not understand why my message does not print. "text" is not a valid field? (same problem with innerHtml) When I add

 area.text = 'Hello'; 

The message is displayed in the text box, and printing is good.

+2
source share
1 answer

Use area.value instead of area.text . area.value is a TextAreaElement property that displays the actual value, while area.text is a Node property that gets or sets the contents of area as node text.

+7
source

Source: https://habr.com/ru/post/973131/


All Articles