You need to sign in to do that
Don't have an account?

What wI am trying to display some text on Page by using Lighting componetsould you like to know?
I am trying to display some text on Page by using Lighting componets.i am not getting that text on click on check box Below is my code .Let me knwo where is my code wrong.
A>Component attribute define
Lightning tag with aura id defined in it
**<aura:attribute name="CheckBoxValue" type="Boolean" default="false"/>**
**<lightning:input aura:id="checkBoxAM" label="Are you new to this course" name="HaveYouTakenCourseBefore" type="checkbox" onchange="{!c.onClickCheckBox}"/>**
B>This is my Aura if conditiontag along with text to be displayed
Hello You have checked this box
C>THis is my JS function in Controller
onClickCheckBox: function(component,event,helper) {
// accesing the value of attribute HaveYouTakenCourseBefore;
// Call function defined in helper;
// hlpr.<Function Name in helper>
console.log("This text is from helper function"); helper.onClickCheckBoxhelper(component); }
D>This is my FUnction defined in helper
onClickCheckBoxhelper : function(component) {
//body of helper resourse
// define logic of your function
console.log("This text is from helper function");
var checkBoxValue =component.find("checkBoxAM").get("v.checked"); component.set("v.checkBoxAM",checkBoxValue);
E> Calling this Component in my Lightning App
PFA screen shot
<lightning:input aura:id="checkBoxAM" label="Are you new to this course" value="{!CheckBoxValue}" name="HaveYouTakenCourseBefore" type="checkbox" onchange="{!c.onClickCheckBox}"/>
2. should assign to checkBoxValue not checkboxAM; and need to defined a local variable to populate data and assign to v.checkboxValue
onClickCheckBoxhelper : function(component) {
//body of helper resourse
// define logic of your function
let localCheckBoxValue = ......;
console.log("This text is from helper function");
var checkBoxValue =component.find("checkBoxAM").get("v.checked"); component.set("v.checkBoxValue",localCheckBoxValue);