Thursday, June 19, 2014

Submit Form When User Clicks Option (autosubmit) - Typeahead.js

http://stackoverflow.com/a/18483816/1364191

The bolded section below will automatically submit your form when you select an option from the Typeahead.js dropdown:
$('#remote .typeahead').typeahead(null, {
 displayKey: 'value',
 source: site_search.ttAdapter()
}).on('typeahead:selected', function(e){
      e.target.form.submit();
    });

No comments:

Post a Comment