jQuery Simple Example

by ardalis

HTML

<script src="//www.addressfinder.co.nz/assets/v2/widget.js"></script>
Some Buttons To Format
<button class="buttons" >One</button>
<button class="buttons" >Two</button>
<button class="buttons" >Three Four Five</button>
<hr />
<button id="formatButton">
Format Them
</button>

CSS

body {
    padding: 5px;
}

label {
    font-weight: bold;
}

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

p {
    margin: 1em 0 0;
}

JavaScript

$(document).ready(function() {
  
  $.fn.widest = function() {
    return this.length ? this.width(Math.max.apply(Math, this.map(function() { 
        return $(this).width();
    }))) : this;
	};
  
  $('#formatButton').click(function(){
    $('.buttons').widest();
  });
 });