function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Somnath SharmaSomnath Sharma 

Add text box values in lightning

User-added imageOu
({
    /** Called when button is pressed to add numbers **/
    add : function(component) {
        var sum = component.get("v.nu1") 
                + component.get("v.nu2");
        component.set("v.sum", sum);
    }
})

 <aura:attribute name="num1" type="Integer" />
    <aura:attribute name="num2" type="Integer" />
    <aura:attribute name="sum" type="Integer"/>
    

    <!--Press button to add numbers and display sum-->
    
   <ui:inputText aura:id="nu1" label="nu1"
                        value="{!v.num1}"
                        required="true"/>
    <ui:inputText aura:id="nu2" label="nu2"
                        value="{!v.num2}"
                        required="true"/>
    <ui:button label="Add Numbers" press="{!c.add}"/>
    {!v.num1} + {!v.num2} = {!v.sum}

 
Somnath SharmaSomnath Sharma
The output is Nan.I have posted controller code and the code within component