2

How to get old/previous Value which entered in input text field with onchange() event in LWC ? please help

3

The change event spec doesn't account for an old value so you will need to keep track of the value within the component by writing the old or original value to a component property and then referencing it in your change handler. You could also keep an array or a stack of values if you needed a history of what the values were set to.

oldValue;

handleChange(event) {
    let newValue = event.target.value;
    // compare oldValue to newValue here
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.