Author - StudySection Post Views - 1,655 views
html

How to access HTML elements values in JS code for Lightning Web Component (LWC)?

Here, we will create a button with two arguments (Username and Email) and we will get these arguments in JS code.

HTML Code:

<lightning-button label="Button" title="Button" data-username={username} data-name={policyList.boxId} onclick={jsfunction}>
</lightning-button>

JavaScript Code:

jsfunction(event) {
let username = event.target.dataset.username;
let name = event.target.dataset.name;
console.log('UserName: '+username);
console.log(‘Name: '+name);
}

StudySection gives an opportunity to beginners and experts in .NET framework to go through StudySection’s .NET certification exam and get a .NET Certification Exam for enhancement of career in programming. If you have knowledge of the .NET framework then you can get a certificate through an online exam at StudySection.

Leave a Reply

Your email address will not be published. Required fields are marked *

fiteesports.com rivierarw.com cratosroyalbet betwoon grandpashabet grandpashabet giriş deneme bonusu veren siteler casino siteleri