Guys I am trying to pass some data to my typeahead form, but for some reason my code isn’t working:
This is my HTML CODE:
<input type="text" class="span3" id="getsourCe" data-provide="typeahead" data-items="4" />
This is my Javascript Code:
<script>
var programLang = ['PHP', 'MySQL', 'SQL', 'PostgreSQL', 'HTML', 'CSS', 'HTML5', 'CSS3', 'JSON'];
$('#getsourCe').typeahead({source: programLang})
</script>
The only error I’m getting is Uncaught SyntaxError: Unexpected token.
and I am not even sure its related to the problem. My html code isn’t changing at all!
Just wrap your JS code in a
$(document).ready. You can see it working here: http://jsfiddle.net/EkFQP/Here’s the code: