You need to sign in to do that
Don't have an account?
Lukesh Karmore
What is the use of event.type and event.detail in js file
What is the use of event.type and event.detail ,I used it in js file in lwc
handlesubmit(event){
console.log(event.type);
console.log(event.detail);
}
Thank You
handlesubmit(event){
console.log(event.type);
console.log(event.detail);
}
Thank You
event.type gives the type of event that invoked the controller method to read more about in https://developer.mozilla.org/en-US/docs/Web/API/Event/type
event.detail gives the detail but it is preferred to event.getParam("id")
event.getParam("value") as mentioned in https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/lightning_base_events.htm
It is anticipated that event.detail might be deprecated in the future as stated:
"Although the event.detail syntax continues to be supported, we recommend that you update your JavaScript code to use the following patterns for the onselect handler as we plan to deprecate event.detail in a future release.
event.getParam("id")
event.getParam("value")"
Let me know if it helps you and close your query by marking it as solved so that it can help others in the future.
Thanks.
You can also console.log event like this console.log(event); to see all the values you can check in the developer console.
Please close the thread by marking this as best answer so that it can be useful to others in the future