JavaScript preprocessors can help make authoring JavaScript easier and more convenient. For instance, CoffeeScript can help prevent easy-to-make mistakes and offer a cleaner syntax and Babel can bring ECMAScript 6 features to browsers that only support ECMAScript 5.
Any URL's added here will be added as <script>
s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.
You can apply a script from anywhere on the web to your Pen. Just put a URL to it here and we'll add it, in the order you have them, before the JavaScript in the Pen itself.
If the script you link to has the file extension of a preprocessor, we'll attempt to process it before applying.
You can also link to another Pen here, and we'll pull the JavaScript from that Pen and include it. If it's using a matching preprocessor, we'll combine the code before preprocessing, so you can use the linked Pen as a true dependency.
HTML Settings
Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.
<div class="speech-bubble">
<div id="bubble-title">
AU - Simple Checkout Form
</div>
<div id="bubble-description">
This example shows a basic AddressFinder widget integration within a form however, in this example the widget is being retrieved via JQuery instead of using pure javascript.
</div>
</div>
<form id="form-box" method="get">
<div id="form-title">Shipping Address</div>
<div class="form-header">Address Line 1</div>
<input type="search" class="form-input" id="addrs_1" placeholder="Search address here..."></input>
<div class="form-header">Address Line 2</div>
<input type="text" class="form-input" id="addrs_2"></input>
<div class="form-header">Suburb</div>
<input type="text" class="form-input" id="suburb"></input>
<div class="form-header">State</div>
<input class="form-input" id="state"></input>
<div class="form-header">Postcode</div>
<input class="form-input" id="postcode"></input>
<input class="btn" type="submit" name="next" value="NEXT">
</form>
@import url('https://fonts.googleapis.com/css?family=Open+Sans');
html, body {
padding: 1em 1.5em;
font-family: 'Open Sans', Arial, Helvetica, sans-serif;
font-size: 15px;
width: 650px;
color: #6d6d6d;
}
.speech-bubble {
position: relative;
padding: 1.5em;
border-radius: 10px;
box-sizing: border-box;
background: #eaf5fa;
box-shadow: 0px 2px 15px 0 rgba(0, 0, 0, 0.4);
margin-bottom: 40px
}
.speech-bubble::before {
content: "";
position: absolute;
width: 0;
height: 0;
bottom: -2em;
left: 42.5%;
box-sizing: border-box;
border: 1em solid black;
border-color: transparent transparent #eaf5fa #eaf5fa;
transform-origin: 0 0;
transform: rotate(-45deg);
box-shadow: -4px 4px 5px 0 rgba(0, 0, 0, 0.2);;
z-index: 0;
}
#bubble-title {
font-size: 1.3em;
margin-bottom: 8px;
}
#form-box {
height: content;
padding: 2em 3.5em;
border-top: 50px solid #E8E8E8;
border-left: 2px solid #E8E8E8;
border-right: 2px solid #E8E8E8;
border-bottom: 2px solid #E8E8E8;
}
#form-title {
font-size: 1.6em;
padding-bottom: 6px;
margin-bottom: 25px;
border-bottom: 1.5px solid #E8E8E8;
}
.form-header {
font-size: 16px;
margin-bottom: 2px;
}
.form-input {
width: 70%;
height: 30px;
font-size: 16px;
padding-left: 6px;
}
.form-input:not(:last-child) {
margin-bottom: 15px;
}
input[type=submit] {
display: block;
-webkit-appearance: button;
font-size: 15px;
width: 135px;
height: 36px;
margin-left: 254px;
background-color: #E18988;
color: #FFFFFF;
border: none;
border-radius: 3px;
}
/* Forces .form-input styles onto search type */
input[type=search] {
-webkit-appearance: textfield;
box-sizing: content-box;
}
(function(){
var widget, initAF = function() {
widget = new AddressFinder.Widget(
$("#addrs_1")[0],
"ADDRESSFINDER_DEMO_KEY",
'AU'
);
widget.on("result:select", function(fullAddress, metaData) {
$('#addrs_1')[0].value = metaData.address_line_1;
$('#addrs_2')[0].value = metaData.address_line_2;
$('#suburb')[0].value = metaData.locality_name;
$('#state')[0].value = metaData.state_territory;
$('#postcode')[0].value = metaData.postcode;
});
};
$( document ).ready(function() {
$.getScript('https://api.addressfinder.io/assets/v3/widget.js', initAF);
});
})();
Also see: Tab Triggers