0

I have a lightning-input tag in my LWC HTML file and i want to get the final value of the text which user inputs. I have a onchange event but it gives me value on every change. for eg. if the user inputs good. It gives me values as g,go,goo,good. I want the last value i.e. good.

<lightning-input type="text" required label="Please provide details" placeholder="Add your comments" onchange={handleTextChange} name={question.questionApiName} value={textValue}></lightning-input>

1
  • Just when is it that you actually need the value? During a button execution? If so, you could always find the input in your template DOM when that button is executed, and simply get that input's "value" property value.
    – Phil W
    May 22, 2020 at 9:25

1 Answer 1

1

For a lookup inputs, generally its recommended to add a timeout to avoid any unnecessary Apex calls.


If you want to get the final value after the change, use the onblur event .

The blur event fires when an element has lost focus.

Here is a playground link.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .