javascript - jquery typeahead and address picker? -
with release of bootstrap 3.0 typeahead plugin has been removed , replaced twitters typeahead plugin. idea how can use in conjunction addresspicker plugin.
my old code worked this:
$('#location').addresspicker({ boundelements: { '#wizard .country': function(data) { var result = ''; $.each(data.address_components, function (index, value) { if (value.types.indexof('country') !== -1) { result = value.long_name; } }); return result; }, '#wizard .state': 'administrative_area_level_1', '#wizard .city': 'locality', '#wizard .postalcode': 'postal_code', '#wizard .lat': 'lat', '#wizard .lng': 'lng' } });
the event trigger new type ahead looks this:
$('#location').typeahead({ /* ??? */ });
i first place, why should replace "old" typeahead plugin? twitters typeahead plugin not bundled twitter's bootstrap 3 javascript plugins.
in code include both like:
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> <script src="bootstrap3/bootstrap-master/dist/js/bootstrap.min.js"></script> <script src="js/bootstrap-typeahead.js"></script> <!-- down load required version here: https://github.com/flevour/jquery-addresspicker/blob/master/demo/js/bootstrap-typeahead.js-->
second use twitters typeahead instead of "old" typeahead don't need change call (only). addresspicker plugin calls typeahead .typeahead() on (form element). have change call or @ least options in source code of addresspicker plugin.
if address picker works should not try change typeahead.
Comments
Post a Comment