title: Jquery Mobile Listview Autocomplete: how to trigger function when user presses enter?
body: <p>I’m following the jquery mobile remote autocomplete demo:</p>
  
  <p><a href="http://jquerymobile.com/demos/1.3.0-beta.1/docs/demos/listviews/listview-filter-autocomplete.html" rel="nofollow">http://jquerymobile.com/demos/1.3.0-beta.1/docs/demos/listviews/listview-filter-autocomplete.html</a></p>
  
  <p>My list is being dynamically populated from my datasource fine and I can do things when the user clicks on a result from the list.</p>
  
  <p>However I also need it to trigger a function when the user hits enter (or clicks “Go” on the phone)... How can I do this? Here's my current code:</p>
  
  <pre><code>$( document ).on( "pageinit", "#myPage", function() {
          $( "#autocomplete" ).on( "click","li",function() {
              // do stuff when user clicks on item in list
              alert('Doing stuff!');                
          });
          $( "#autocomplete" ).on( "listviewbeforefilter", function ( e, data ) {
              var $ul = $( this ),
                  $input = $( data.input ),
                  value = $input.val(),
                  html = "";
              $ul.html( "" );
              if ( value &amp;&amp; value.length &gt; 2 ) {
                  $ul.html( "&lt;li&gt;&lt;div class='ui-loader'&gt;&lt;span class='ui-icon ui-icon-loading'&gt;&lt;/span&gt;&lt;/div&gt;&lt;/li&gt;" );
                  $ul.listview( "refresh" );
                  $.ajax({
                      url: "http://mywebservice/"+$input.val(),
                      dataType: "json",
                      crossDomain: false
                  })
                  .then( function ( response ) {
                      $.each( response, function ( i, val ) {
                          html += "&lt;li&gt;&lt;a href='#'&gt;" + val.display_name + "&lt;/a&gt;&lt;/li&gt;";
                      });
                      $ul.html( html );
                      $ul.listview( "refresh" );
                      $ul.trigger( "updatelayout");
                  });
              }
          });
  });
  </code></pre>
  
  <p>I've been searching alot for help, but most results have been talking about the jquery autocomplete and not the jquery mobile listview autocomplete...</p>
  
  <p>Any help would be much appreciated -thanks!</p>