lundi 29 juin 2015

External function call from JSNI is not working


I am trying to translate this JavaScript code to JSNI code.

Script Imports

<script src="jquery-1.11.2.min.js"></script>
<script src="jquery.typeahead.min.js"></script>
<script src="autocompletetest/autocompletetest.nocache.js"></script>


Script

$('#q').typeahead({  
    minLength: 1,  
    order: "asc",  
    group: true,   
    groupMaxItem: 6,  
    hint: true,  
    dropdownFilter: "All",  
    href: "http://ift.tt/1HtBBLN}}",  
    template: "{{display}}, <small><em>{{group}}</em></small>",  
    source: {  
        country: {  
            data: data.countries  
        },  
        capital: {  
            data: data.capitals  
        }  
    },
    ...

To

$doc.getElementsByClassName("q").typeahead({
    ...
})

But I'm getting this error:

@com.citi.sevi.client.AutocompleteTest::loadJquery()([]): $doc.getElementsByClassName(...).typeahead is not a function

What could be causing this error?


Aucun commentaire:

Enregistrer un commentaire