Skip to content

Instantly share code, notes, and snippets.

@mohammad-hammal
Last active October 30, 2018 06:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mohammad-hammal/7434a177e428ab0c2ca2ba0a7fc1b2fe to your computer and use it in GitHub Desktop.
Save mohammad-hammal/7434a177e428ab0c2ca2ba0a7fc1b2fe to your computer and use it in GitHub Desktop.
var $ = require('jquery');
var calculator = require('./calculator');
$(function(){
$('form').on('submit', function(event) {
event.preventDefault();
var dateValue = $('.date-input').val();
if (!dateValue) {
alert('Please enter valid value');
return;
}
var age = calculator.getAge(dateValue);
alert(age);
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment