I have a textarea
component that has an onChange
attribute.
I want to make some function that will console log the textarea
value when the user stops typing in the textarea
. One idea I had would be to make a function that saves after 1 second of waiting, but the timer restarts when it is called.
So like this:
function save() {
// wait for one second (this resets if save() is called again)
// console.log(textarea.value)
}
How could I do something like this?