Typeahead's built-in highlighting component is not large enough by default to fit your requirements.
I will give an example with mark.js , a text label for search queries / keywords or custom regular expressions. Please browse the website to learn more about the API.
DEMO JSFIDDLE
$(function() {
input { width: 250px; padding: 3px; } mark { background: yellow; color: black; }
<script src="https://code.jquery.com/jquery-2.2.4.min.js"></script> <script src="https://cdn.rawgit.com/julmot/mark.js/6.1.0/dist/jquery.mark.min.js"></script> <script src="https://cdn.rawgit.com/twitter/typeahead.js/v0.11.1/dist/typeahead.bundle.min.js"></script> <div id="bloodhound"> <input class="typeahead" type="text" placeholder="States of USA. Type in 'rh is' or 'bag take'"> </div>
Firstly, you will have to disable the built-in backlight component by default (disabled by default). Then you will need to listen for the renderer event and initialize mark.js in typeahead clauses.
source share