javascript - twitter typeahead create extra link in dropdown -
i'd override default behavior of twitter typeahead.
when suggestion shows, i'd able add <a>
or <button>
tag, when specific button clicked, doesn't typical dropdown row submit.
i know how templating render button/link in template, can't figure out how override whole row click individual button click.
templates: { header: '<h3 class="search-set">asdf</h3>', suggestion: function(context) { return mustache.render(template, context); } }
thanks in advance.
well, use custom events triggered typeahead on selection.
if need button it's more of mustache question really. 1 solution add onclick handler generated html via jquery, e.g.
suggestion: function(context) { var html = mustache.render(template, context); $('button', html).on('click', function(){alter('something')}); return html; }
Comments
Post a Comment