Get selected items value for Bootstrap's typeahead

前端 未结 6 1857
萌比男神i
萌比男神i 2021-01-01 20:17

Bootstrap just implemented a neat autocomplete feature called typeahead. I am having trouble getting the appropriate value for the text input.

For instance, I might

6条回答
  •  灰色年华
    2021-01-01 20:34

    If you only had 1 on the page you could try $('ul.typeahead li.active').data('value'); but you may have have issues if there's more than 1 on a page.

    I wonder if there's a reason why the input value is not set?

提交回复
热议问题