Home > database >  How can I get the date format from an initialized Bootstrap datepicker?
How can I get the date format from an initialized Bootstrap datepicker?

Time:05-27

I have the following bootstrap datepicker:

<input type="dtpicker" id="abc" name="abc" value="26-05-2022">

$('input[type="dtpicker"]').datepicker({
    format: "dd/mm/yyyy",
    clearBtn: true,
    autoclose: true,
    orientation: "bottom right",
    autoUpdateInput: true
});

How can I get "format" option by code (either Javascript or jQuery)?

Generally, how can I get datepicker options?

CodePudding user response:

$(element).data().datepicker.o.format

See How to access properties and functions of a jQuery plugin.

  • Related