flatpickr + javascript in shortpants. no trousers for them anymore

please, how can this 4 lines be written in 2 lines?

$("#display_from").val(res.display_from);
$("#display_to").val(res.display_to);
flatpickr("#display_from", flatpickrconfig);
flatpickr("#display_to", flatpickrconfig);

dumbbot gave me this:

$("#display_from").val(res.display_from).flatpickr(flatpickrconfig);
$("#display_to").val(res.display_to).flatpickr(flatpickrconfig);

which does not work obviously:

Uncaught TypeError: $(...).val(...).flatpickr is not a function

please anyone, i'm repeating this same 4 liners all over the place. they already making me sick. someone help me cut their pants.



Comments

Popular posts from this blog

Spring Elasticsearch Operations

Network Error and Timeout on Authorize.net JS

Object oriented programming concepts (OOPs)