Can not using Bloodhound in website (Error: Bloodhound is not defined)

332 Views Asked by At

I want to use Typehead for input field but it appeared following error

Bloodhound is not defined

I already implement some library

<script src="jquery/typeahead/typeahead.bundle.js"></script>
<script src="jquery/typeahead/typeahead.bundle.min.js"></script>
<script src="jquery/jquery-3.4.1.min.js"></script>

Here is my script

<script>
    $(document).ready(function(){
        var courses = ['PRN292', 'SWT201', 'PRO201', 'JPD201'];
        var courses = new Bloodhound({
            datumTokenizer: Bloodhound.tokenizers.whitespace,
            queryTokenizer: Bloodhound.tokenizers.whitespace,
            local: courses
        });

        $('.typehead').typehead({
            hint: true,
            highlight: true,
            minLength: 1
            },
            {
            name: 'courses',
            source: courses
        });
    });
</script>

Here is my html code

<div class="form-group">
    <h2>Course code</h2>
    <input type="search" class="typehead" autocomplete="off" spellcheck="false">
</div>
0

There are 0 best solutions below