• Hello,

    In your fields templates you often have inline javascript such as the button field:

    jQuery( function($){
    
    		$(document).on('click dblclick', '#<?php echo $field_id; ?>', function( e ){
    			$('#<?php echo $field_id; ?>_btn').val( e.type ).trigger('change');
    		});
    
    	});

    To maximise our page speed insights score we need to load our javascript in the footer of our website, which makes this code break, as jQuery is not loaded yet when this attempts to execute. To fix this I change the code to:

    window.onload = function(){
    
    		$(document).on('click dblclick', '#<?php echo $field_id; ?>', function( e ){
    			$('#<?php echo $field_id; ?>_btn').val( e.type ).trigger('change');
    		});
    
    	}

    Is there a chance this change (or something similar) could be incorporated into your plugin please?

    Thanks,
    Ellie

    https://ww.wp.xz.cn/plugins/caldera-forms/

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)

The topic ‘Request: Change inline javascript to allow jquery inclusion in footer’ is closed to new replies.