简体   繁体   中英

autocomplete mixed with keydown

I do an autocomplete with jQuery/Ajax and I want to bind to events,when I fill the input to get some displayed values(autocomplete) or when I hit the submit button as well:

$('input[type='text']').on('keydown',function() { 

    displayFunction();

});

OR 

$('input[type='submit']').on('click',function() { 

   displayFunction();

});

I want to have something which can mix the 2 events:

$('').on('keydown click',function() {//Here in the 2 differents input...
      displayFunction();
});

Thanks for your help!!!!

Separe both selector with , :

$("input[type='text'], input[type='submit']").on('keydown click',function() {//Here in the 2 differents input...
      displayFunction();
});

Live Demo

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM