Search code examples
jquerybootstrap-typeahead

Attaching Typeahead row with anchor tag


I am using ajax call to populate data in my dropdown using Typeahead`, now the HTML Typeahead creates for every row in dropdown look like

<li class="active" data-value="xx">
    <a href="#">
        my Text
    </a>
</li>

My requirement is to have some value in anchor tag where when user clicks on dropdown text, it takes user to new page.

Can anyone point me in right direction?


Solution

  • This can be achieved by using updater attribute in Typeahead as code in updater gets called on click of row in Typeahead dropdown.

    code

    updater: function (item) {            
           // do whatever you want to do here
        }