jQuery Simple Example

by dj19910501

HTML

<script src="//www.addressfinder.co.nz/assets/v2/widget.js"></script>
<label for="search_field">Address</label>
<input type='text' class='address_field' />

CSS

body {
    padding: 5px;
}

label {
    font-weight: bold;
}

input[type=text] {
    width: 20em
}

p {
    margin: 1em 0 0;
}

JavaScript

$(document).ready(function() {
function yes(){
  return new Promise(function(resolve, reject) {
    setTimeout(function() {
      reject('foo');
    }, 3000);
  });
}
  
  yes().then(function(b){
  alert(b)
  }, function(b){
  alert(b)
  
  });
  
});