You need to sign in to do that
Don't have an account?
Mike O.
Read value from component in controller.js
I have the following in the component:
I'd like to multiply this value with the number entered in "input1" and display it.
I do not seem able to read the value that is in "input1". I tried
thank you
<lightning:input type="number" aura:id="input1" name="input1" value="1" required="true" />In the controller.js I have an action that returns a value from the component controller.
I'd like to multiply this value with the number entered in "input1" and display it.
I do not seem able to read the value that is in "input1". I tried
alert('cmp.find(input1) = ', cmp.find('input1').get('v.value'));and it shows an empty value.
thank you
Use '+' in your alert, you are using ' ,' in alert
Use below code of snippet in your code and your alert will be shown the value
alert('cmp.find(input1) = '+ c.find('input1').get('v.value'));
I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.
Thanks and Regards,
Amit Singh Rathaur
All Answers
Use '+' in your alert, you are using ' ,' in alert
Use below code of snippet in your code and your alert will be shown the value
alert('cmp.find(input1) = '+ c.find('input1').get('v.value'));
I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.
Thanks and Regards,
Amit Singh Rathaur