Twitter bootstrap typeahead custom keypress ENTER function

前端 未结 3 1646
孤城傲影
孤城傲影 2020-12-30 08:20

I\'m working with Twitter bootstrap on a Django site I\'m making. I have a page where users can enter all of their technical skills in a text input equipped with a bootstra

3条回答
  •  -上瘾入骨i
    2020-12-30 09:19

    $(document).keyup(function(event) {
        if (event.keyCode == 13) {    
        $('#yourtextbox').val("");  
        $('#yourtextbox').typeahead('close');
        }
      });
    

    you can find the documentation of typeahead here https://github.com/twitter/typeahead.js/blob/master/doc/jquery_typeahead.md

提交回复
热议问题