Hello,
I want to use an external js function, a js typeahead, and call it in the input of my jsp, but it is not working accordingly.
Importing js from my jsp.
<script src="javascript/todospaises.js" type="text"></script>
As for the Html code, the input, which has to receive the js function.
@Html
<input type="text" id="input-paises" class="typeahead" placeholder="Países">
And, the function code of the external js, that is, of another file.
var $input = $("#input-paises");
$input.typeahead({source:[‘Brasil, Estados Unidos, Inglaterra, Alemanha’,
]});
However, typeahead does not work when, the function of another js is used. The function is only effective, when it is in the same jsp,
<script> var $input = $("#input-paises"); $input.typeahead({source:[‘Brasil, Estados Unidos, Inglaterra, Alemanha’, ]}); <script>
That is, only when it is in jsp. Only when the js code snippet stays in jsp.
Thank you!