1

This is my input box.

<input type="text" class="form-control" id="contestCode" name="contestCode" required >

My jQuery Snippet which checks for keyup event and paste event

$('#contestCode').on({
            keyup : function(){
                checkContestCodeIfExists($(this));
            },
            paste : function(){
                checkContestCodeIfExists($(this));
            }
    });

But when the user clicks on the autoSuggest provided by the browser (Code exists for the auto suggest provided by the browser because I already gave that code as input once) ,I am not able to listen to that event. How can I do that in jQuery?

Abhinav
  • 8,028
  • 12
  • 48
  • 89
  • You could potentially hook into the change event of the text input. Though that would not fire until the element loses focus. – jeremysawesome Jun 15 '15 at 06:13
  • Also - you might check this question: http://stackoverflow.com/questions/11708092/detecting-browser-autofill This also might be a good place to look: https://github.com/tbosch/autofill-event – jeremysawesome Jun 15 '15 at 06:16
  • thanx for your suggestion @jeremysawesome. solved it using the change method – Abhinav Jun 15 '15 at 06:23

1 Answers1

0

I solved it using the change event as per the suggestion in comments

$('#contestCode').on({
            keyup : function(){
                checkContestCodeIfExists($(this));
            },
            paste : function(){
                checkContestCodeIfExists($(this));
            },
            change : function(){
                checkContestCodeIfExists($(this));
            }
    });
Abhinav
  • 8,028
  • 12
  • 48
  • 89