I have setup jQuery listeners that listen for form input in the type="text" field. However, when the user selects a parameter from the autocomplete drop-down list (i.e., the Value they entered earlier that was remembered for future use), the listeners below do not collect this value.
Here is my current code:
$('#text-input').on("keyup change paste", function() { var textInput = $(this).val();
The above steps are for inserting and entering text, but not if the option is selected from the list of prompts with a drop-down list.
Can someone tell me what the listener needs to add?
Greetings.
My decision
autocomplete I tried using the autocomplete , I found that this did not work in my script, so instead I added the following code inspired by the accepted answer.
var timer = 0; $('#text-input').on("keyup change paste", function() { if (timer != null) { clearTimeout(timer); timer = setTimeout(function() { var textInput = $(this).val();
An added benefit of this is that my text input takes a URL and then uses it to load additional content onto the page. Having a set timeout means that the script is not constantly trying to load the URL while the user is still typing it.
source share