jqueryajaxvalidationthickbox

jQuery validation not working in Thickbox display ajax call


I'm using Thickbox 3.1 with jQuery 1.3.2 with the Validation plugin and all works great when I run the pages individually but when I use Thickbox the page popup (As it should) but the validation on the page now doesn't work (Inside the Thickbox), any help on this would be great.

BTW the strange thing is that Thickbox looks to be working inside the Thickbox but not the validation (Which is on the page itself).

Adding Code:

page1.html (JavaScript)

$(document).ready(function () {
    $("#page1Form").validate({
        rules: {
            "field1": {
                required: true,
                digits: true
            },
            "field2": {
                required: true
            }
        },
        errorElement: "div"
    });
});

index.html (Thickbox link)

<a href="page1.html" class="thickbox">Page 1</a>

I can view source on the Thickbox popup and I see all the JS code and libraries are there but it's not running the validation in the Thickbox Popup.


Solution

  • I think the even handelers are being set on page load, so they aren't set on the thickbox generated html. Can't you set a callback to start the validationi after the thickbox ajaxloads the content?