@@ -23,47 +23,51 @@ function gw_disable_submit( $form ) {
2323
2424 <script type="text/javascript">
2525
26- jQuery( document ).ready( function( $ ) {
26+ document.addEventListener('DOMContentLoaded', function() {
27+ if (typeof jQuery !== 'undefined') {
28+ jQuery( document ).ready( function( $ ) {
2729
28- var formId = '<?php echo $ form ['id ' ]; ?> ';
30+ var formId = '<?php echo $ form ['id ' ]; ?> ';
2931
30- $( '#gform_submit_button_' + formId ).on( 'click', function( event ) {
32+ $( '#gform_submit_button_' + formId ).on( 'click', function( event ) {
3133
32- if( hasPendingFileUploads( formId ) ) {
33- return;
34- }
35-
36- var $submitCopy = $( this ).clone();
37-
38- $submitCopy
39- .attr( 'id', '' )
40- .prop( 'disabled', true )
41- .attr( 'value', 'Processing...' )
42- .insertBefore( $( this ) );
34+ if( hasPendingFileUploads( formId ) ) {
35+ return;
36+ }
4337
44- $ ( this ).css( { visibility: 'hidden', position: 'absolute', transition: 'all 0s ease 0s' } );
38+ var $submitCopy = $ ( this ).clone( );
4539
46- } );
40+ $submitCopy
41+ .attr( 'id', '' )
42+ .prop( 'disabled', true )
43+ .attr( 'value', 'Processing...' )
44+ .insertBefore( $( this ) );
4745
48- function hasPendingFileUploads() {
46+ $( this ).css( { visibility: 'hidden', position: 'absolute', transition: 'all 0s ease 0s' } );
4947
50- if( ! window[ 'gfMultiFileUploader' ] ) {
51- return false;
52- }
48+ } );
5349
54- var pendingUploads = false;
50+ function hasPendingFileUploads() {
5551
56- $.each( gfMultiFileUploader.uploaders, function( i, uploader ) {
57- if( uploader.total.queued > 0 ) {
58- pendingUploads = true;
52+ if( ! window[ 'gfMultiFileUploader' ] ) {
5953 return false;
6054 }
61- } );
6255
63- return pendingUploads;
64- }
56+ var pendingUploads = false;
57+
58+ $.each( gfMultiFileUploader.uploaders, function( i, uploader ) {
59+ if( uploader.total.queued > 0 ) {
60+ pendingUploads = true;
61+ return false;
62+ }
63+ } );
64+
65+ return pendingUploads;
66+ }
6567
66- } );
68+ } );
69+ }
70+ });
6771
6872 </script>
6973
0 commit comments