jQuery's autocomplete : customize behavior of “ESCAPE” key press


I am using jQuery's autocomplete plugin and want to customize the behavior when user press the "ESCAPE" key as below,

<ol><li>when user types text to search, its corresponding results are listed. Without selection any result if "ESCAPE" key is pressed, then the search text entered should be removed. [Default Behavior: the search text is retained] <ol><li>In <a href="http://jqueryui.com/demos/autocomplete/#multiple-remote" rel="nofollow">http://jqueryui.com/demos/autocomplete/#multiple-remote</a>, user can search multiple times. Assume, he has entered a text and has selected a row from the drop down. Now, he searches again, but without selecting any result, he presses "ESCAPE" key, then the search string alone should be removed (and not the previously selected one).</li> </ol></li> </ol>

any help is appreciated.


something like this

$(document).ready( function() { $("#birds").keypress(function (e) { if(e.keyCode == 27) { $("#birds").val(""); }} }); });


(function( $ ) { $( "#input" ).live('keydown', function(e) { var keyCode = e.keyCode || e.which; if(keyCode == 27) { //Processing } }); }( jQuery ));


  • How to make a real-time jquery effect?
  • How to use datatable from code behind in jqxgrid
  • Ordering list with jQuery drag and drop
  • C++ password masking
  • JQuery Mobile 1.4 How to Disable Hover Effect on Mobile Devices
  • WCF Service Application returns 404 using WebGet
  • Nested jQuery tabs
  • How do I detect which submit button was pressed on a Zend Framework form?
  • Determining if a string has been entered with a leading single quote
  • Type mismatch: cannot convert from Connection to Connection
  • Drag and Drop for imageview not working
  • Capturing HTML Text Input Key press after key has been applied?
  • How to get value of the slider, when touchend or mouseup events are used?
  • Positioning children objects in scene (car wheels hierarchy)
  • Can I update/select from a table in one query?
  • Ionic Slide Up Slide Down Animation for only one view in sidebar
  • Tools for understanding HTML layout
  • Flash radiobutton: how do I get the selected radiobutton?
  • How can I restyle a word when rendering a pdf with pdf.js?
  • uml Composition relationships to RDF and OWL
  • Javascript, Regex - I need to grab each section of a string contained in brackets
  • Possible to get mouse events fired when cursor is outside page?
  • How to make R's read_csv2() recognise the text characters properly
  • Conversion from string “a” to type 'Boolean' is not valid
  • Install PHP intl extension on MacOS
  • Why HTML5 Canvas with a larger size stretch a drawn line?
  • Spray.io: When (not) to use non-blocking route handling?
  • Modifying destination and filename of gulp-svg-sprite
  • Updated Ionic CLI but shows previous version (Windows)
  • GridView Sorting works once only
  • Numpy divide by zero. Why?
  • php design question - will a Helper help here?
  • bootstrap to use multiple ng-app
  • Data Validation Drop Down Box Arrow Disappearing
  • How to get icons for entities from eclipse?
  • AngularJs get employee from factory
  • Turn off referential integrity in Derby? is it possible?
  • IndexOutOfRangeException on multidimensional array despite using GetLength check
  • Authorize attributes not working in MVC 4
  • JaxB to read class hierarchy