I have a lightning component that contains a textarea. There is an oninput event that fires on the textarea so I can inspect the value as it changes.
<textarea aura:id="my-textarea" placeholder="Comment here..." oninput="{!c.handleTextArea}"></textarea>
In the controller, I want to inspect the value of the textarea. The value property should contain the text that's in the textarea.
handleTextArea : function(component, event, helper) {
// this doesn't work, the value is always undefined
var text = event.target.value;
console.log(text);
// this way doesn't work either, the value is undefined
text = component.find("my-textarea").getElement().value;
console.log(text);
}
This issue started after the Summer '16 update in our org. Prior to the upgrade this was working fine.
Interestingly, if I change the <textarea>
tag to an <input>
then the value is available as expected.
Is this a bug? Or am I missing something obvious here?
Thanks in advance!
Best Answer
I suspect that this is a bug in LockerService (the .value attribute not being properly exposed in the secure virtual DOM). Have you opened a case with Salesforce support on this yet?