Reputation: 73
How can I do this? I basically want to call a function where I get the info from the textbox once the user is done entering info. I.e., after they click off of the text box. I couldn't find the clear way to do this. Is there an API for event/actions and what you can do on each input?
Upvotes: 1
Views: 368
Reputation: 59293
Try the blur
event:
yourTextBox.onblur = function() {
console.log(yourTextBox.value);
};
or
yourTextBox.addEventListener('blur', function() {
console.log(yourTextBox.value);
});
See the documentation for the blur
event on MDN here.
Upvotes: 1