-1
  $('.showloader').click(function () {
      $('.loader').fadeIn();

  });

I have a loading css called .loader It is default Display:none

I would like to have it display when click the .showloader . This will submit a register form that has jquery validated method.

What is the best way to fadeOut this div tag if the user enter the wrong input validate or forget to input some field and they have to enter the data again.

Thanks

2
  • I guess the validate has a callback action ... so there you can fadeout the element Commented Mar 21, 2017 at 19:02
  • I found the answer from this link stackoverflow.com/questions/2505053/… Commented Mar 21, 2017 at 19:06

1 Answer 1

0

I Have found the answer from this post : jQuery Validation plugin: add/remove class to/from element's error container

Just use highlight method inside validate

$('#indexform').validate({
    rules: {
      firstName: {
        required: true
      },
      lastName: {
        required: true
      },
      address1: {
        required: true
      },
      city: {
        required: true
      },
      state: {
        required: true
      },
      country: {
        required: true
      },
      zip: {
        required: true,
        rangelength: [5,5],
        digits: true
      },
      phone: {
        required: true
      },
      email: {
        required: true,
        email: true
      }
    },
    messages: {
      zip: 'Zip code must be 5 digits'
    },
    highlight: function(element) {
      $('.loader').fadeOut();
    },
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.