Question

I cannot get text from my textarea :

Very simple textarea :

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

My dart code :

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

When i write a message in area and press send , just display :

send

I don't understand why my message is not print. 'text' is not the correct field ? (same problem with innerHtml) When I add

area.text = 'Hello';

The message is visible in textarea and print is well.

Was it helpful?

Solution

Use area.value instead of area.text. area.value is a property of TextAreaElement that gets the actual value displayed, whereas area.text is a property of Node that gets or sets the content of area as a text node.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top