javascript - External function call from JSNI is not working -
i trying translate javascript code 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: "https://en.wikipedia.org/?title={{display}}", 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 error:
@com.citi.sevi.client.autocompletetest::loadjquery()([]): $doc.getelementsbyclassname(...).typeahead not function
what causing error?
jquery's $
function isn't getelementsbyclassname
wrapper, wraps result in jquery
object, plugins live. call typeahead
method, have use $win.$("q")
Comments
Post a Comment