Quick note, I realise there are already well supported libraries that do this, such as the excellent parsley.js [1].<p>This was a just for fun project to work on my coding skills! The approach is different and it is very lightweight - working out at just 16kb before minification and 5kb after.<p>Enjoy.<p>[1]: <a href="https://github.com/guillaumepotier/Parsley.js" rel="nofollow">https://github.com/guillaumepotier/Parsley.js</a>