[jQuery] [validate] Problem with validation on a form pulling in with Ajax
I have a script that generates a form. I'm pulling this form into a
dialog box on my main index page via Ajax and trying to attached the
Validate plugin to the form.
So I've got this:
$("a.attendee_add").click(function() {
//Get href from link
var addURL = $(this).attr("href");
//Ajax get from href link
$.get(addURL, function(data){
//Display content in dialog box
$(data).dialog({
height: "auto",
width: "auto",
resizable: false,
draggable: false,
position: "center",
modal: true,
overlay: {
background: "#333333"
},
close: function(ev, ui) { $(this).dialog("destroy").remove(); }
});
//Attach validate plugin
$("#attendee_editForm").validate();
});
return false;
});
However it doesn't work.
If I don't pull the form in with ajax and instead just paste it into
my index page and add in $("#attendee_editForm").validate(); to the
document ready function it works so I know my form is marked up
properly.
Has anyone any idea how I can get this working?
Thanks