
Security News
Vite Releases Technical Preview of Rolldown-Vite, a Rust-Based Bundler
Vite releases Rolldown-Vite, a Rust-based bundler preview offering faster builds and lower memory usage as a drop-in replacement for Vite.
jquery-postcodes
Advanced tools
Add UK address lookups with a simple postcode input field on any web form with the Ideal-Postcodes.co.uk API. Ideal Postcodes uses Royal Mail's addressing database, the Postcode Address File (PAF).
Add UK address lookups with a simple postcode input field on any web form with the Ideal-Postcodes.co.uk API. Ideal Postcodes uses Royal Mail's addressing database, the Postcode Address File (PAF).
PAF is licensed from the Royal Mail and is, unfortunately, not free to use. Ideal Postcodes aims to be simple to use and fairly priced to use for web and mobile developers.
We charge 2p per external lookup.
This plugin creates an input field to lookup postcodes on the Ideal Postcodes API. If the user searches a valid postcode, a dropdown menu is displayed and the selected address is piped into appropriate fields.
The plugin provides addresses according to Royal Mail's Addressing Guidelines. i.e. Maximum of 3 address lines, a Post Town and Postcode. More address data is also available.
<script src="jquery.js"></script>
<script src="jquery.postcodes.min.js"></script>
Sign up to get an API key
Configure Ideal Postcodes by applying your API Key and identifying your address fields with CSS selectors
<script>
$.idealPostcodes.setup({
// Set your API key
api_key: 'ak_Iddqd8Idkfa7Idchoppers8',
// Pass in CSS selectors pointing to your input fields to pipe the results
output_fields: {
line_1: '#first_line',
line_2: '#second_line',
line_3: '#third_line',
post_town: '#post_town',
postcode: '#postcode'
}
});
</script>
<div id="postcode_lookup_field"></div>
<script>
$('#postcode_lookup_field').setupPostcodeLookup();
</script>
By rigging just 5 fields in the above example, you will have the necessary information you need (and in the correct formatting) to identify any household in the UK by mail.
However, you can extract more information on each address for your addresss form by passing more properties into the output_fields object.
Here's the complete list of available data fields:
output_fields: {
line_1: "<css_selector>", // Address Line 1
line_2: "<css_selector>", // Address Line 2
line_3: "<css_selector>", // Address Line 3
post_town: "<css_selector>", // Post Town
postcode: "<css_selector>", // Postcode
udprn : "<css_selector>", // Unique Delivery Point Reference Number
organisation_name : "<css_selector>", // Organisation Name
department_name : "<css_selector>", // Department Name
po_box : "<css_selector>", // PO Box Number
postcode_inward : "<css_selector>", // Postcode Inward Code
postcode_outward : "<css_selector>", // Postcode Outward Code
building_number : "<css_selector>", // Building Number
building_name : "<css_selector>", // Building Name
sub_building_name : "<css_selector>", // Sub Building Name
thoroughfare : "<css_selector>", // Thoroughfare
dependant_thoroughfare : "<css_selector>", // Dependant Thoroughfare
dependant_locality : "<css_selector>", // Dependant Locality
double_dependant_locality : "<css_selector>", // Double Dependant Locality
postcode_type : "<css_selector>", // Postcode Type
su_organisation_indicator : "<css_selector>", // Organisation Type
delivery_point_suffix : "<css_selector>", // Delivery Point Suffix
longitude : "<css_selector>", // Organisation Type
latitude : "<css_selector>", // Organisation Type
northings : "<css_selector>", // Northings
eastings : "<css_selector>" // Eastings
}
More information on what these fields mean can be found here
To add them into your form, simply include it in output_fields when initialising Ideal Postcodes. The example below demonstrates how the organisation name can be routed to the input with the id "organisation_field"
<script>
$.idealPostcodes.setup({
api_key: 'ak_Iddqd8Idkfa7Idchoppers8',
output_fields: {
line_1: '#first_line',
line_2: '#second_line',
line_3: '#third_line',
post_town: '#post_town',
postcode: '#postcode',
organisation_name: '#organisation_field'
}
});
</script>
More documentation can be found here
MIT
v1.1.1
FAQs
Add UK address lookups with a simple postcode input field on any web form with the Ideal-Postcodes.co.uk API. Ideal Postcodes uses Royal Mail's addressing database, the Postcode Address File (PAF).
The npm package jquery-postcodes receives a total of 121 weekly downloads. As such, jquery-postcodes popularity was classified as not popular.
We found that jquery-postcodes demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Vite releases Rolldown-Vite, a Rust-based bundler preview offering faster builds and lower memory usage as a drop-in replacement for Vite.
Research
Security News
A malicious npm typosquat uses remote commands to silently delete entire project directories after a single mistyped install.
Research
Security News
Malicious PyPI package semantic-types steals Solana private keys via transitive dependency installs using monkey patching and blockchain exfiltration.