Q
Q
Qurel2020-06-15 10:42:08
JavaScript
Qurel, 2020-06-15 10:42:08

How to make in datetimepicker so that when you click on the calendar icon again, the calendar closes?

How to make in datetimepicker so that when you click on the calendar icon again, the calendar closes by analogy if you click on input?

I tried 2 options, but the calendar does not close when you click on the calendar icon:

$('.fa-calendar').on('click' ,function(){
    // Первый вариант
    if($(this).prev().not(':focus')) {
        $(this).prev().trigger('focus');
    } else {
        $(this).prev().trigger('blur');
    }

    // второй вариант
    if($(this).prev().not(':focus')) {
        $(this).prev().focus();
    }
    else {
        $(this).prev().blur();
   }
});

Answer the question

In order to leave comments, you need to log in

1 answer(s)
J
Jupiter Max, 2020-06-15
@Qurel

What plugin are you using? Or did you do it yourself?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question