Is it valid to place javascript inside the pre display function? Once I put the javascript snippet to the pre_display action, in the preview form of Form editor it shows “An error occurred loading the preview (Ajax error)”,
I have tried to put it into the jQuery document ready function as well, it still showed “An error occurred loading the preview (Ajax error)”, However, it could prompt the alert test message on the front end. <?php add_action('quform_pre_display_XX', function (Quform_Form $form) { ?> <script> jQuery(document).ready(function($){ alert('test'); }); </script> <?php }); ?>