Workstation JavaScript PostcodeLookup
Masked Input Plugin
Javascript Include:
{function.javascript(#jquery.postcode.js#)}
CSS Include
not needed for this plugin
Required DOM Elements
- input text field (to input postcode, default id = postcode)
- input button (call the plugin from this element)
- element with loading message (default id = loading, hidden)
- input drop down list (default id = selectaddress, hidden)
- input button (default id = btnFetch)
- container element (default id = address)
- with inputs:
- input text field (id must contain %company%)
- input text field (id must contain %first_line_address%)
- input text field (id must contain %second_line_address%)
- input text field (id must contain %town%)
- input text field (id must contain %county%)
Note: elements with default values can have different ids set which must be declared when calling the plugin i.e. example 2
Default Values
//this is the url that the request will be sent to (This will need to be overridden)
- site_url:
//these are the default ids of the elements in the form
- postcode_field_id:'postcode'
- loading_id:'loading'
- address_id: 'address'
- address_list_id: 'selectaddress'
- select_id:'btnFetch'
Example Usage:
$(function(){
var url_input = "www.example.com"
//example 1
$('#btnFind').getAddress({site_url: url_input}); // creates with default values
//example 2
$('#btnFind3').getAddress({site_url:url_input, postcode_field_id: 'postcode2', loading_id: 'loading2',
address_id: 'billing_address', address_list_id: selectaddress2', select_id: 'btnFetch2'});
});
