Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Australian Business Number (ABN) format validation for 'jQuery validation'
function abnValidate(value, element){
if (value.length != 11 || isNaN(parseInt(value)))
return false;
var weighting =[10,1,3,5,7,9,11,13,15,17,19];
var tally = (parseInt(value[0]) - 1) * weighting[0];
for (var i = 1; i < value.length; i++){
tally += (parseInt(value[i]) * weighting[i]);
return (tally % 89) == 0;
abnValidate, 'This ABN is not valid'

This comment has been minimized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment