wip datepicker, added an intercepter to the originale function to get the arguments
This commit is contained in:
@@ -1,12 +1,31 @@
|
|||||||
let datepicker_wrapper = document.querySelector(".datepicker-wrapper");
|
//let datepicker_wrapper = document.querySelector(".datepicker-wrapper");
|
||||||
console.log("datepicker-wrapper: ", datepicker_wrapper);
|
//console.log("datepicker-wrapper: ", datepicker_wrapper);
|
||||||
|
//
|
||||||
|
//let mydate = document.createElement("input");
|
||||||
|
//mydate.setAttribute('type', 'text');
|
||||||
|
//mydate.setAttribute('style', 'margin-top:10px;');
|
||||||
|
//datepicker_wrapper.appendChild(mydate);
|
||||||
|
//
|
||||||
|
//console.log("mydate: ", mydate);
|
||||||
|
//mydate.value = "oups";
|
||||||
|
//
|
||||||
|
//$(mydate).datepicker({dateFormat: "yymmdd",});
|
||||||
|
|
||||||
let mydate = document.createElement("input");
|
|
||||||
mydate.setAttribute('type', 'text');
|
|
||||||
mydate.setAttribute('style', 'margin-top:10px;');
|
|
||||||
datepicker_wrapper.appendChild(mydate);
|
|
||||||
|
|
||||||
console.log("mydate: ", mydate);
|
|
||||||
mydate.value = "oups";
|
|
||||||
|
|
||||||
$(mydate).datepicker({dateFormat: "yymmdd",});
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* overriding the datepicker function to intercept the arguments
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
// Store the original jQuery UI datepicker function
|
||||||
|
const originalDatepicker = jQuery.fn.datepicker;
|
||||||
|
jQuery.fn.datepicker = function(options) {
|
||||||
|
// Log the function call and its arguments
|
||||||
|
console.log('Datepicker function is called with options:', options);
|
||||||
|
|
||||||
|
// Call the original datepicker function with the same arguments
|
||||||
|
return originalDatepicker.call(this, options);
|
||||||
|
};
|
||||||
|
|||||||
@@ -37,9 +37,9 @@ jquery date picker :
|
|||||||
function add_form_builder_dates_patch() {
|
function add_form_builder_dates_patch() {
|
||||||
$handle = 'form_builder_dates_patch';
|
$handle = 'form_builder_dates_patch';
|
||||||
$url = Fbpatch::root_url() . '/js/dates.js';
|
$url = Fbpatch::root_url() . '/js/dates.js';
|
||||||
$dependencies = array();
|
$dependencies = array('jquery-ui-datepicker');
|
||||||
$version = null;
|
$version = null;
|
||||||
$defer = true;
|
$defer = false;
|
||||||
wp_enqueue_script($handle, $url, $dependencies, $version, $defer);
|
wp_enqueue_script($handle, $url, $dependencies, $version, $defer);
|
||||||
}
|
}
|
||||||
add_action('wp_enqueue_scripts', __NAMESPACE__.'\add_form_builder_dates_patch', 22);
|
add_action('wp_enqueue_scripts', __NAMESPACE__.'\add_form_builder_dates_patch', 22);
|
||||||
|
|||||||
Reference in New Issue
Block a user