I’d like to capture the following event: when the user has started typing something in an input field, stopped typing for more than 3 seconds, with the value not having changed during these 3 seconds.
Thanks for the update. In fact, I’ve been trying to find a new angle at my UI issue.
Indeed, I’m faced with this: how to call a javascript function when the user leaves an input field except when he clicks on an on-line keyboard.
The page displays an on-line keyboard with some letters that the user might not have on his actual keyboard.
When the user has the cursor in the input field, he can type in and also click on some letters of the on-line keyboard, which acts as if the user had typed in these letters.
The on-line keyboard works fine.
But, if I want to implement an onchange event handler on the input field, the handler is called even if the user clicks on a letter of the on-line keyboard.
I wonder if there would not be a way, with jQuery probably, to capture the onchange event and wait to see if a click on the on-line keyboard letter has not happened, before actually firing up the validation method.
A simple way is for the onchange event to use setTimeout to trigger its function. The timeout could be just for 50ms, but even that is a small amount of time for the online keyboard to cancel that timeout event.
Your fiddle has the code in an onload event, which means that functions like getInstantFeedbackIfNoKeyboardClick() are not visible from the HTML inline attribute events.
Use “no wrap (body)” instead and you will see better results.
Even better than that though is to assign the onblur event from within the script itself.
I have a similar issue, kindly help. I need to capture the value from an input field and on blur the value has to be stored in a variable for me to write into a database. Pl find my code below, it is not storing the value i typed in the textbox.