I'm using jQuery Validate (v. 1.2.1) on a page with several forms. I iterate
through the forms using each(). The validation is working but when I try to
append a loader (using ajaxStart()), it's appended to the wrong div (always
on the second form).


The code:


$(document).ready(function() {
  var loader = jQuery('<div id="loader"><img
src="_js/loading.gif" alt="loader" width="20"
height="20"></div>');
  $.validator.setDefaults({
    debug: true,
    focusInvalidElement: true,
    submitHandler: function(form) {
      $(form).ajaxForm();
      var options = { target: $(form).parent(), clearForm: true, resetForm:
true }
      $(form).ajaxSubmit(options);
    }
  });
  $("form").each(function(i){
    $(this).validate();
    $(this).ajaxStart(function(){
      $(this).parent().append(loader);
    })
  });
});


Another problem is that IE 6 sends the message twice...

Thanks for your help.

-- 
View this message in context: 
http://www.nabble.com/Validate-plugin-problem-tp16912097s27240p16912097.html
Sent from the jQuery General Discussion mailing list archive at Nabble.com.

Reply via email to