Create index.js

added a validate function for the cart add button.