Skip to content

Latest commit

 

History

13 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Postcoder Integrator

A JavaScript library for address lookup and validation, for use in the DOM.

Getting Started

  1. Import the Library

Include the integrator.min.js file from the build folder in your HTML:

<script src="integrator.min.js"></script>

Or via CDN:

<script src="https://cdn.jsdelivr.net/gh/postcoder-api/integrator-js@v2/build/integrator.min.js"></script>
  1. Activate the Library

Create a new instance using the constructor:

const postcoder = new PostcoderAddressAutocomplete(options);
  • Replace options with your configuration object.

Example

<script>
  document.addEventListener("DOMContentLoaded", function () {
    const postcoder = new PostcoderAddressAutocomplete({
      apikey: "YOUR_API_KEY",
      country: "#country",
      searchinput: "#search_input",
      outputfields: {
        addressline1: "#address_line_1",
        addressline2: "#address_line_2",
        posttown: "#post_town",
        county: "#county",
        postcode: "#postcode",
      },
    });
  });
</script>

Library development

If you wish to fork this repository and edit it for your own needs, please feel free.

Install the required packages with npm ci, and run Rollup and a local development server with npm start.

index.ts initiates the library, with handlers.ts attaching functions from actions.ts to HTML elements in the DOM. Data to be shared between functions in the library is stored in objects imported from data.ts.

Documentation

About

A quick and easy way of setting up Postcoder Address Autocomplete on any web page.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages