简体   繁体   中英

Bootstrap4 tempus dominus DateTimePicker doesn't show up

I followed this , and there is no error message but the datetimepicker doesn't appear on the input element.

<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
<script src="/html/template/default/assets/js/function.js"></script>
<script src="/html/template/admin/assets/js/vendor/moment.min.js"></script>
<script src="/html/template/admin/assets/js/vendor/moment-with-locales.min.js"></script>
<script src="/html/template/admin/assets/js/vendor/tempusdominus-bootstrap-4.min.js"></script>

<script>
    $(function () {

        $('input.datetimepicker-input').datetimepicker({
            locale: 'ja',
            format: 'YYYY-MM-DD HH:mm:ss',
            useCurrent: true,
            buttons: {
                showToday: true,
                showClose: true
            },
        });

    
    });
</script>

<input type="text" id="shopping_order_time" name="_shopping_order[time]" required="required" class="datetimepicker-input" data-target="#shoppingtakeout_time" data-toggle="datetimepicker">

If someone has any idea about what is causing the problem could you please help?

The problem was that the value of the data-target was not the element's id.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM