Changed event listeners from button clicks to JQuery submit events

Moved JQuery library to the header to it loads before the event code