How to get old/previous Value which entered in input text field with onchange() event in LWC ? please help
1 Answer
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
}