Skip to content

Instantly share code, notes, and snippets.

@5minpause
Last active January 6, 2016 14:53
Show Gist options
  • Save 5minpause/f4d08bdeeec9b4724bad to your computer and use it in GitHub Desktop.
Save 5minpause/f4d08bdeeec9b4724bad to your computer and use it in GitHub Desktop.
validVinExp: function () {
// WDD 169 007-1J-236589
// WDB1681331J93895
return new RegExp('^(wdb|wdd)\\s*[\\d\\s]{6,}-?[\\w\\d]{2}-?[\\d]{5,6}$', 'i');
},
evaluateVin: function (value) {
return this.validVinExp().test(value);
},
vinOnChange: function () {
var vinInput = document.getElementsByName('car[vin]');
if (vinInput.length > 0) {
vinInput.on('change', function(e) {
App.carSelect.evaluateVin(vinInput.value);
});
}
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment