This is my HTML
<input data-provide="typeahead" type="text" id="actor" name="actor" autofocus="autofocus" maxlength="30" value="" required="required">
I am using Ajax for source :
actors = getActors();
$('#actor').typeahead({
source: actors,
items: 10
});
If i keep my input div id as actor then everything thing works well but if change DIV id from actor to actor[] then typeahead is not working .
For actor[] id my code is :
<input data-provide="typeahead" type="text" id="actor[]" name="actor" autofocus="autofocus" maxlength="30" value="" required="required" >
actors = getActors();
$('#actor[]').typeahead({
source: actors,
items: 10
});
If anybody know solution for this type input ID please your solution.
Presumably jQuery’s selector engine is trying to interpret
'#actor[]'as an element qualified by the presence of an attribute and isn’t matching. Why is it necessary to use that kind of an ID (a pair of empty square brackets is commonly used as a suffix on form element names so that PHP or similar code will convert the values of multiple elements with the same name into arrays, but IDs are by definition unique within a page)?