jQuery Simple Example

HTML

<script src="//www.addressfinder.co.nz/assets/v2/widget.js"></script>
<div id="1">
</div>
<div id="2">
</div>
<div id="8">
</div>
<div id="11">
</div>

CSS

body {
    padding: 5px;
}

label {
    font-weight: bold;
}

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

p {
    margin: 1em 0 0;
}

JavaScript

$(document).ready(function() {
	$('div').each(function() {
		$(this).append('id antigo: ' + $(this).attr('id'));
	});
  
  $('div').each(function(index, element) { 
		$(element).attr('id', index + 1);
	});
  
  $('div').each(function() { 
		$(this).append(' id novo: ' + $(this).attr('id'));
	});
});