Ask a Question
Ask Question Login
Corporate Training
  1. Community
  2. Salesforce
  3. Question
Salesforce

How to assign an e target value in a JS file when the event is taking place from the Lightning Radio button in HTML?

Asked by Buffy Heaton May 4, 2023 1.4K views 1 answer
Share

About this question

I am writing a code in JS to receive name and value attributes from the Lightning-Input Radio button where an event will take place on selection. But in the JS file, it's giving me an error while assigning the event values to const variables. Please help.

HTML CODE



JS CODE
    changeHandler(event)
    {   
         const {name, value} = event.target;
         const name = event.target.name;
         const value1 = event.target.value;
         console.log('name', event.target.name);
         console.log('value', event.target.value);
        
    }

ERROR LINES Note: Just added both ways of assigning values for clarification.

         const {name, value} = event.target;
         const name = event.target.name;
         const value1 = event.target.value;
ERROR Screenshot

Your answer

1 Answer

More Salesforce discussions

Learn & Explore

Free tutorials and interview questions from industry experts — learn the skill, then get ready to prove it.

Latest Salesforce Blogs

Guides, tips and career advice on Salesforce from JanBask experts.