$(selector).dataAddress(options);
- Sets up autocomplete for input field(s).
options
: An object literal which defines the settings to use for the autocomplete plugin. Available option settings listed below.
This example will add auticomplete to field #address-lookup-field
and onSelect field #streetNameFieldId
will have be populated with street name.
$('#address-lookup-field').dataAddress({
serviceUrl: 'https://api.atomatodata.com.au/v1/geo/search/lookup',
apiToken: '##################',
useNA: true
formFields: {
streetName: '#streetNameFieldId'
}
})
serviceUrl
: API endpointapiToken
: API Access TokenuseNA
: Pass N/A to form fieldformFields
: List of fields to map values into
onSelect: function (suggestion) {}
: Callback function invoked when user selects suggestion from the list. this inside callback refers to input HtmlElement.
address
: Full address linebuildingName
: Building name if availableflatNumber
: Flat/Unit number if availablehighlight
: Highlighted resultlatitude
: Latitudelongitude
: LongitudelocalityName
: Suburb namelotId
: Full Plan/Lot IDlotNumber
: Lookup Plan/Lot IDpostcode
: Location Postcodestate
: State NamestreetName
: Street NamestreetSuffix
: Street SuffixstreetType
: Street Type
Autocomplete instance has following methods:
setOptions(options)
: you may update any option at any time. Options are listed above.clear
: clears suggestion cache and current suggestions.clearCache
: clears suggestion cache.disable
: deactivate autocomplete.enable
: activates autocomplete if it was deactivated before.hide
: hides suggestions.dispose
: destroys autocomplete instance. All events are detached and suggestion containers removed.
Based on Ajax Autocomplete for jQuery which is freely distributable under the terms of an MIT-style license.
Copyright notice and permission notice shall be included in all copies or substantial portions of the Software.
Tomas Kirda / @tkirda
Alexander Tsirel / @noma4i