简体   繁体   中英

trigger colorbox resize on parsley validation

OK so basically I am using parsley.js validate and colorbox to submit a form via ajax

The problem I am facing is that I cannot figure out how to resize the colorbox dynamically when the validation errors appear.I would like to trigger this function when pasreley loads in the errors.

$.colorbox.resize();

This is what the form submit code looks like

   $("#form").submit(function(e)
    {

        if ( $(this).parsley('validate')) {

            var postData = new FormData(this);

            var formURL = $(this).attr("action");

            $.ajax({});
        }; 

        e.preventDefault();

    });

try

$.listen('parsley:field:error', function(){$.colorbox.resize();})

If you wish to handle the error event. See official documentation to know the event which you want to handle. http://parsleyjs.org/doc/index.html#psly-events-list

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM