javascript - Bootstrap 3 Typeahead doesn't appear -
hello i'm trying integrate bootstrap-3-typeahead project, code :
... {!! form::text('brands', null ,array('id'=>'brands', 'data-provide' =>'typeahead', 'class'=>'typeahead form-control')) !!} ... <script type="text/javascript"> //var tags = []; var brandsnames = []; var brandsids = []; @foreach($brands $brand) brandsnames[brandsnames.length] = "{{ $brand->get('name') }}"; brandsids["{{$brand->get('name')}}"] = "{{ $brand->getobjectid() }}"; @endforeach; console.log(brandsnames); console.log(brandsids); $("#name").typeahead({ source:brandsnames }); </script>
and html tag after compiling php file :
<input type="text" name="brands" class="typeahead form-control" data-provide="typeahead" id="brands">
brandsname content :
["samsung", "sony", "appel", "lg", "asus", "nokia", "htc", "blackberry"]
also i've tried use standar version of typeahead :
<script src="http://twitter.github.io/typeahead.js/releases/latest/typeahead.bundle.js"></script>
but i'm getting same issue suggestion list dosn't appear
$("#name").typeahead({ source:brandsnames });
change selector $("#name")
$("#brands")
.
Comments
Post a Comment