How to combine these two JQuery Function with else or else if statement, Lost little here!!

How to combine these two JQuery Function with else or else if statement, Lost little here!!

I am trying to write these two function into simple else statement, where once validation is good and complete, page loading jquery begins.

Please guide, I tried a few things, none seem to work as need.


[code]

  1. <script type="text/javascript">
  2. /* <![CDATA[ */
  3. jQuery(function () {
  4. jQuery("#oldpassword").validate({
  5. expression: "if (VAL.length > 5 && VAL) return true; else return false;",
  6. message: "Please enter a Current Password"
  7. });
  8. jQuery("#password").validate({
  9. expression: "if (VAL.length > 5 && VAL) return true; else return false;",
  10. message: "Please enter a valid New Password"
  11. });
  12. jQuery("#confirmpassword").validate({
  13. expression: "if ((VAL == jQuery('#password').val()) && VAL) return true; else return false;",
  14. message: "Confirm password doesn't match the new password"
  15. });
  16. }); /* ]]> */
  17. </script>
  18. <script type="text/javascript">
  19. /* <![CDATA[ */
  20. $(document).ready(function () {
  21. $("#loading-div-background").css({
  22. opacity: 0.8
  23. });
  24. });
  25. function ShowProgressAnimation() {
  26. $("#loading-div-background").show();
  27. $(".button-2").hide();
  28. } /* ]]> */
  29. </script>

[/code]