Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR TYPESCRIPT

data binding lwc multiple

in HTML
<lightning-input name='firstName' label="First Name" onchange={handleChange}></lightning-input>
<lightning-input name='lastName' label="Last Name" onchange={handleChange}></lightning-input>

In Controller
handleChange(event) {
        const field = event.target.name;
        if (field === 'firstName') {
            this.firstName = event.target.value;
        } else if (field === 'lastName') {
            this.lastName = event.target.value;
        }
    }
Source by newstechnologystuff.com #
 
PREVIOUS NEXT
Tagged: #data #binding #lwc #multiple
ADD COMMENT
Topic
Name
5+1 =