1jQuery(document).ready(function ($) { 2 function initializeDatepickers() { 3 var datepickerElements = $('input[data-setting="daterange"]'); 4 5 datepickerElements.each(function () { 6 $(this).val(''); // Ensure the field is empty by default 7 $(this).daterangepicker({ 8 locale: { 9 format: 'YYYY-MM-DD' 10 }, 11 autoUpdateInput: false, // Prevent automatic update of the input value 12 opens: 'left' 13 }, function(start, end, label) { 14 $(this.element).val(start.format('YYYY-MM-DD') + ' - ' + end.format('YYYY-MM-DD')); 15 }); 16 17 // Update the input field manually on apply 18 $(this).on('apply.daterangepicker', function(ev, picker) { 19 $(this).val(picker.startDate.format('YYYY-MM-DD') + ' - ' + picker.endDate.format('YYYY-MM-DD')); 20 }); 21 22 // Clear the input field on cancel 23 $(this).on('cancel.daterangepicker', function(ev, picker) { 24 $(this).val(''); 25 }); 26 }); 27 } 28 29 // Initialize datepickers on document ready 30 initializeDatepickers(); 31 32 // Ensure datepickers are initialized when Elementor editor is ready 33 $(window).on('elementor/frontend/init', function () { 34 elementorFrontend.hooks.addAction('frontend/element_ready/widget', function ($scope) { 35 initializeDatepickers(); 36 }); 37 }); 38 39 // Ensure datepickers are initialized when Elementor controls are changed 40 elementor.hooks.addAction('panel/open_editor/widget', function (panel, model, view) { 41 initializeDatepickers(); 42 }); 43});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.