Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

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.

+ add another resource


Babel includes JSX processing.

Add External Scripts/Pens

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.

+ add another resource


Add Packages

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.


Auto Save

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.


                <h2>Wellington Airport East Community Action Group - registration</h2>

  Demonstrates using a polygon to define an allowed area for
  Example address within the allowed area: 
  <code>2 Puriri Street, Miramar, Wellington 6022</code>

<form method="get" target="_new">
  <label for="name">Name</label>
  <input type="text" id="name" name="name">
  <label for="address1">Address</label>
  <input type="search" id="address_line_1" name="address_line_1" placeholder="Enter address here" class="address-field"><br>
  <input type="text" id="address_line_2" name="address_line_2" class="address-field">

  <label for="suburb">Suburb</label>
  <input type="text" id="suburb" name="suburb" class="address-field">

  <label for="city">Town/City</label>
  <input type="text" id="city" name="city" class="address-field">
  <label for="postcode">Postcode</label>
  <input type="text" id="postcode" name="postcode" class="address-field">
    <input type="submit" name="submit" value="Register">

<!-- Jquery -->
<script src=""></script>



                body {
    padding: 5px;

label {
    margin: 1em 0 0;
    display: block;

input[type=text] {
    width: 20em

input[type=search] {
    width: 20.6em

h2 {
    font-weight: bold;

p {
    margin: 1em 0 0;



                (function() {
    var polygon = [ 
    var widget, initAF = function() {
        widget = new AddressFinder.Widget(
            'NZ', {
                "address_params": {}
      widget.on('result:select', function(selectedAddress, metaData) {
        let selected = new AddressFinder.NZSelectedAddress(selectedAddress, metaData);
        var selectedAddressCoordinates = [metaData.x, metaData.y]
        if (!isInsidePolygon(selectedAddressCoordinates, polygon)) {
          alert('Sorry, you dont seem to live in the Airport East area.')
        } else {
          document.getElementById('address_line_1').value = selected.address_line_1();
          document.getElementById('address_line_2').value = selected.address_line_2();
          document.getElementById('suburb').value = selected.suburb();
          document.getElementById('city').value =;
          document.getElementById('postcode').value = selected.postcode();  
  function isInsidePolygon(point, vs) {
    var x = point[0], y = point[1];

    var isInside = false;
    for (var i = 0, j = vs.length - 1; i < vs.length; j = i++) {
        var xi = vs[i][0], yi = vs[i][1];
        var xj = vs[j][0], yj = vs[j][1];

        var intersect = ((yi > y) != (yj > y)) && (x < (xj - xi) * (y - yi) / (yj - yi) + xi);
        if (intersect) isInside = !isInside;
    return isInside;

    function downloadAF(f) {
        var script = document.createElement('script');
        script.src = '';
        script.async = true;
        script.onload = f;
    document.addEventListener('DOMContentLoaded', function() {