How to fire jQuery function only if form is valid How to fire jQuery function only if form is valid javascript javascript