Hope this isn't too off topic, but I've have to say that tackling this problem solely in JavaScript is never going to completely solve the problem, in the main due to the fact that it's trvial to stomp all over whatever logic you try and impose using browser developer tools, etc. (You also can't presume that everyone has JavaScript enabled, etc.)
As such, whilst you can carry out some nice real-time validation, etc. using JavaScript (with jQuery for nice visual effects, etc.) you'll need to carry out the real validation in whatever server side environment you're using.
In terms of the JavaScript 'validation' itself, simply attach functions that update the appropriate parts of the DOM with success/failure messages to the onchange, etc. events of the relevant inputs. See http://www.w3schools.com/jS/js_form_validation.asp for the basics.