HTML preprocessors can make writing HTML more powerful or convenient. For instance, Markdown is designed to be easier to write and read for text documents and you could write a loop in Pug.
In CodePen, whatever you write in the HTML editor is what goes within the <body>
tags in a basic HTML5 template. So you don't have access to higher-up elements like the <html>
tag. If you want to add classes there that can affect the whole document, this is the place to do it.
In CodePen, whatever you write in the HTML editor is what goes within the <body>
tags in a basic HTML5 template. If you need things in the <head>
of the document, put that code here.
The resource you are linking to is using the 'http' protocol, which may not work when the browser is using https.
CSS preprocessors help make authoring CSS easier. All of them offer things like variables and mixins to provide convenient abstractions.
It's a common practice to apply CSS to a page that styles elements such that they are consistent across all browsers. We offer two of the most popular choices: normalize.css and a reset. Or, choose Neither and nothing will be applied.
To get the best cross-browser support, it is a common practice to apply vendor prefixes to CSS properties and values that require them to work. For instance -webkit-
or -moz-
.
We offer two popular choices: Autoprefixer (which processes your CSS server-side) and -prefix-free (which applies prefixes via a script, client-side).
Any URLs added here will be added as <link>
s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.
You can apply CSS to your Pen from any stylesheet on the web. Just put a URL to it here and we'll apply it, in the order you have them, before the CSS in the Pen itself.
You can also link to another Pen here (use the .css
URL Extension) and we'll pull the CSS from that Pen and include it. If it's using a matching preprocessor, use the appropriate URL Extension and we'll combine the code before preprocessing, so you can use the linked Pen as a true dependency.
JavaScript preprocessors can help make authoring JavaScript easier and more convenient.
Babel includes JSX processing.
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.
Search for and use JavaScript packages from npm here. By selecting a package, an import
statement will be added to the top of the JavaScript editor for this package.
Using packages here is powered by esm.sh, which makes packages from npm not only available on a CDN, but prepares them for native JavaScript ESM usage.
All packages are different, so refer to their docs for how they work.
If you're using React / ReactDOM, make sure to turn on Babel for the JSX processing.
If active, Pens will autosave every 30 seconds after being saved once.
If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.
If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.
Visit your global Editor Settings.
<div class="container">
<!-- header -->
<nav class="navbar navbar-expand-lg navbar-light bg-light">
<div class="container-fluid">
<a class="navbar-brand" href="#">
<img src="https://www.loqate.com/content/images/loqate_logo_dark.svg" style="height: 50px">
</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<div class="navbar-nav me-auto mb-2 mb-lg-0">
<span class="navbar-text">
<h4>Business API Demo - Loqate ANZ</h4>
</span>
</div>
<div class="navbar-nav ms-auto mb-2 mb-lg-0">
<div class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdownMenuLink" role="button" data-bs-toggle="dropdown" aria-expanded="false">
Sales Support Menu
</a>
<ul class="dropdown-menu" aria-labelledby="navbarDropdownMenuLink">
<li><a class="dropdown-item" target="_blank" href="https://www.loqate.com/anz/contact/">Contact Sales</a></li>
<li><a class="dropdown-item" target="_blank" href="https://developer.mastersoftgroup.com/harmony/api/method/address.html">API Documentation</a></li>
<li><a class="dropdown-item" target="_blank" href="https://www.loqate.com/anz/support/">Contact Support</a></li>
</ul>
</div>
</div>
</div>
</div>
</nav>
<div class="accordion" id="accordionExample">
<div class="accordion-item">
<h2 class="accordion-header" id="headingOne">
<button class="accordion-button" type="button" data-bs-toggle="collapse" data-bs-target="#collapseOne" aria-expanded="true" aria-controls="collapseOne">
Settings
</button>
</h2>
<div id="collapseOne" class="accordion-collapse collapse show" aria-labelledby="headingOne" data-bs-parent="#accordionExample">
<div class="accordion-body">
<div class="row">
<form class="row g-3">
<div class="col-auto">
<label for="env" class="visually-hidden">Env</label>
<select class="form-control" id="env">
<option value="https://hosted.mastersoftgroup.com">Production</option>
<option value="https://preview.harmonyrightaddress.net">Preview</option>
<option value="https://test.harmonyrightaddress.net">Test</option>
<option value="https://dev.harmonyrightaddress.net">Dev</option>
</select>
</div>
<div class="col-auto">
<label for="apiUser" class="visually-hidden">API User</label>
<input type="text" class="form-control" id="apiUser" placeholder="API User">
</div>
<div class="col-auto">
<label for="password" class="visually-hidden">Password</label>
<input type="password" class="form-control" id="password" placeholder="Password">
</div>
<div class="col-auto">
<button class="btn btn-primary mb-3" onclick="return start(true)">Start</button>
<button class="btn btn-light mb-3" type="button" data-bs-toggle="collapse" data-bs-target="#collapseExample" aria-expanded="false" aria-controls="collapseExample">
Options
</button>
</div>
</form>
<div>
<div class="collapse" id="collapseExample">
<div class="card card-body">
<div class="row">
<div class="col-md-4">
<div class="form-floating">
<input type="text" class="form-control" id="hits" placeholder="Top Hit Number" value="10">
<label for="hits">Top Hit Number</label>
</div>
</div>
<div class="col-md-4">
<div class="form-floating">
<input type="text" class="form-control" id="minLength" placeholder="Min Length" value="3">
<label for="minLength">Min Length to Start Search</label>
</div>
</div>
<div class="col-md-4">
<div class="form-floating">
<select class="form-select" aria-label="Environment" id="caseType">
<option value="UP">Upper</option>
<option value="LOW">Lower</option>
<option value="TITLE">Title</option>
</select>
<label for="caseType">Case Type</label>
</div>
</div>
</div>
<p />
<div class="row">
<div class="col-md-4">
<div class="form-floating">
<select id="bnCountry" class="form-select">
<option value="AU">Australia</option>
<option value="NZ">New Zealand</option>
</select>
<label for="bnCountry" class="form-label">Country</label>
</div>
</div>
<div class="col-md-4">
<div class="form-floating">
<select id="bnStatus" class="form-select">
<option value="">ALL</option>
<option value="act">Active</option>
<option value="can">Cancelled</option>
</select>
<label for="bnStatus" class="form-label">Business Number Status</label>
</div>
</div>
<div class="col-md-4">
<div class="form-floating">
<select id="taxStatus" class="form-select">
<option value="">ALL</option>
<option value="act">Active</option>
<option value="can">Cancelled</option>
<option value="non">None</option>
</select>
<label for="taxStatus" class="form-label">Tax Status</label>
</div>
</div>
</div>
<p />
<div class="mb-3">
<label class="form-label">States</label>
<div class="row">
<div class="col">
<input name="states" type="checkbox" value="NSW" id="statesNSW" checked />
<label for="statesNSW">NSW</label>
</div>
<div class="col">
<input name="states" type="checkbox" value="VIC" id="statesVIC" checked />
<label for="statesVIC">VIC</label>
</div>
<div class="col">
<input name="states" type="checkbox" value="QLD" id="statesQLD" checked />
<label for="statesQLD">QLD</label>
</div>
<div class="col">
<input name="states" type="checkbox" value="ACT" id="statesACT" checked />
<label for="statesACT">ACT</label>
</div>
<div class="col">
<input name="states" type="checkbox" value="SA" id="statesSA" checked />
<label for="statesSA">SA</label>
</div>
<div class="col">
<input name="states" type="checkbox" value="WA" id="statesWA" checked />
<label for="statesWA">WA</label>
</div>
<div class="col">
<input name="states" type="checkbox" value="NT" id="statesNT" checked />
<label for="statesNT">NT</label>
</div>
</div>
</div>
<p />
<div class="mb-3">
<label class="form-label">Name Types</label>
<div class="row">
<div class="col">
<input name="nameTypes" type="checkbox" value="MN" id="nameTypesMN" checked />
<label for="nameTypesMN">MN</label>
</div>
<div class="col">
<input name="nameTypes" type="checkbox" value="BN" id="nameTypesBN" checked />
<label for="nameTypesBN">BN</label>
</div>
<div class="col">
<input name="nameTypes" type="checkbox" value="TRD" id="nameTypesTRD" checked />
<label for="nameTypesTRD">TRD</label>
</div>
<div class="col">
<input name="nameTypes" type="checkbox" value="OTN" id="nameTypesOTN" checked />
<label for="nameTypesOTN">OTN</label>
</div>
<div class="col">
<input name="nameTypes" type="checkbox" value="LGL" id="nameTypesLGL" checked />
<label for="nameTypesLGL">LGL</label>
</div>
<div class="col">
<input name="nameTypes" type="checkbox" value="DGR" id="nameTypesDGR" checked />
<label for="nameTypesDGR">DGR</label>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="accordion-item invisible" id="businessDemo">
<h2 class="accordion-header" id="headingTwo">
<button class="accordion-button" type="button" data-bs-toggle="collapse" data-bs-target="#collapseTwo" aria-expanded="false" aria-controls="collapseTwo">
Demo
</button>
</h2>
<div id="collapseTwo" class="accordion-collapse collapse" aria-labelledby="headingTwo" data-bs-parent="#accordionExample">
<div class="accordion-body">
<div class="row">
<div class="col-12">
<div id="business-form">
<h5>Business name</h5>
<p style="font-style:italic">Search by typing Name OR Business Number OR Company Number</p>
<div>
<input type="text" id="name" class="form-control" placeholder="Type in business name here e.g. CHRISTINE REED " autocomplete="off" />
</div>
<div class="visually-hidden">
<div class="col-6">
<input id="outputBn" name="outputBn" class="form-control-plaintext visually-hidden" type="text" placeholder="ABN Result" readonly="readyonly" />
</div>
<div class="col-6 hidden"><input id="outputCn" name="outputCn" class="form-control-plaintext visually-hidden" type="text" placeholder="ACN Result" readonly="readyonly" />
</div>
</div>
</br>
<h5>Response</h5>
<p style="font-style:italic">Full response from selection Business Retrieve API</p>
<div class="card card-body">
<pre id="json"></pre>
<div id="error"></div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<link rel="stylesheet" type="text/css" href="https://common.mastersoftgroup.com/scripts/harmony-2.1.0.min.css">
<script src="https://common.mastersoftgroup.com/scripts/harmony-2.1.0.min.js" type="text/javascript"></script>
</div>
let al = null;
function start(show) {
var input = document.getElementById("name");
var outputBn = document.getElementById("outputBn");
var outputCn = document.getElementById("outputCn");
var env = document.querySelector('#env').value;
var user = document.querySelector('#apiUser').value;
var password = document.querySelector('#password').value;
var minLength = document.querySelector('#minLength').value;
var hits = document.querySelector('#hits').value;
var caseType = document.querySelector('#caseType').value;
var country = document.querySelector('#bnCountry').value;
Harmony.useEnv(env);
// Create an api user via the console with domain cdpn.io
Harmony.init(user, password, Harmony.AUSTRALIA);
var opt = {
// optional, min 3 chars to trigger the lookup
minLength: minLength,
//optional, number of candidates to return from search, default is 20
hits: hits,
//optional, case type for the name of business entities, default is whatever the case in the sot
caseType: caseType,
//optional element of bnStatus or string, default is all status
bnStatus: bnStatus,
//optional element of taxStatus or string, default is all status
taxStatus: taxStatus,
//optional, checkbox name for state selection or input element for state, default is all states
state: "states",
//optional, checkbox name for nameTypes selection or input element for nameTypes, default is all types
nameTypes: "nameTypes",
//optional element of country or string or select element of country default is au
country: country,
fieldBn: outputBn,
fieldCn: outputCn,
onSelect: function (ui) {
console.log("address selected: " + JSON.stringify(ui));
},
onRetrieve: function (ui) {
document.getElementById("json").innerText = JSON.stringify(
ui.onRetrieveItem,
null,
2
);
}
};
if (al) {
al.autocomplete.destroy();
al = null;
}
al = HraBusinessJS.businessAutoComplete(input, opt);
if (show) {
document.getElementById("businessDemo").setAttribute("class", "accordion-item visible");
var demoEl = document.getElementById("collapseTwo");
bootstrap.Collapse.getOrCreateInstance(demoEl).show();
}
return false;
}
const matchedEls = document.querySelectorAll('.form-control, .form-select');
matchedEls.forEach(e => e.addEventListener('change', (event) => {start(false);}));
Also see: Tab Triggers