From 086a7ea530016c6e484be3563cffa26758da22ab Mon Sep 17 00:00:00 2001 From: Mohamad Ali Date: Sat, 17 Jul 2021 11:28:14 +0300 Subject: [PATCH] Handle multiple inputs with different ranges --- src/DateTimePicker.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/DateTimePicker.js b/src/DateTimePicker.js index 492be67..66f59b2 100755 --- a/src/DateTimePicker.js +++ b/src/DateTimePicker.js @@ -38,6 +38,8 @@ $.DateTimePicker = $.DateTimePicker || { { mode: "date", defaultDate: null, + + inputElementId:"", dateSeparator: "-", timeSeparator: ":", @@ -576,14 +578,17 @@ $.cf = { if(!oDTP.settings.isInline) { oDTP.oData.oInputElement = null; - + var sel=""; + if (oDTP.options.inputElementId=="" || oDTP.options.inputElementId===undefined){ $(oDTP.settings.parentElement).find("input[type='date'], input[type='time'], input[type='datetime']").each(function() { $(this).attr("data-field", $(this).attr("type")); $(this).attr("type", "text"); }); - - var sel = "[data-field='date'], [data-field='time'], [data-field='datetime']"; + sel = "[data-field='date'], [data-field='time'], [data-field='datetime']"; + }else{ + sel = "[id='"+oDTP.options.inputElementId+"']"; + } $(oDTP.settings.parentElement).off("focus", sel, oDTP._inputFieldFocus) .on ("focus", sel, {"obj": oDTP}, oDTP._inputFieldFocus)