DataPicker can't properly hung, where is the error?

xdsoft.net/jqplugins/datetimepicker use this picker.
<input type="text" class="input_birthday">
<input type="checkbox" class="input_birthday_year" id="not_year">
<label for="not_year"><span>unknown Year</span></label>


$('.input_birthday_year', $this).change(function(){
 var options = {format:"d.m.Y"},
 $date_picker = $('.input_birthday', $(this).parents('.edit_form'));
 if ($(this).is(':checked')){$.extend(options, {format: "d.m"});}
$date_picker.datetimepicker(options);
});
$('.input_birthday_year', $this).change();


When checked, text box, year, needs to be clipped, but I do not.
July 9th 19 at 10:28
1 answer
July 9th 19 at 10:30
If you asked questions in a more readable format, then it will be easier to understand and reply respectively. Hope for yours understanding.
Okay if the text is not clear, I think the code speaks for itself. - shani commented on July 9th 19 at 10:33
: Not really. Don't understand what behavior you are trying to achieve. Standard question: "1. I have so-and-so. 2. I want to get a certain result. 3. To do this, I do a certain action. 4. Instead of the expected result I see that." - Korey.Quigley commented on July 9th 19 at 10:36
: Great, now you at least pointed out what are trying to achieve :) - Korey.Quigley commented on July 9th 19 at 10:39
: So, look:

var $input_birthday = jQuery('.input_birthday'),
 $input_birthday_year = jQuery('.input_birthday_year'),
 defaults = {
 format: 'd.m.Y',
 timepicker: false,
};

// Init
$input_birthday.datetimepicker(defaults);

// Attach event
$input_birthday_year.on('change', function(){
 var is_checked = $(this).is(':checked'),
 checked_settings = jQuery.extend({}, defaults, {format: 'd.m'});
 $input_birthday.datetimepicker(is_checked ? checked_settings : defaults).datetimepicker('validate');
});


So everything works :) - Korey.Quigley commented on July 9th 19 at 10:42
: Thanks! Now an hour meditate on your code and sort out what's what.
I've been using .val() and in the mining() has made working variant, but it looks scary. - shani commented on July 9th 19 at 10:45
: Please! You will succeed :) - Korey.Quigley commented on July 9th 19 at 10:48

Find more questions by tags HTMLJavaScriptjQuery