Why does datetimepicker work on Google Chrome and on Mozilla Firefox does not work? [duplicate]

1

This code works for me by calling an input and displaying the date in chrome but in firefox it does not work:

<div class='input-group date'>
   <input  type='text' id="date_ex" name="date_emi" class="form-control" />
            <span class="input-group-addon">
                <span class="glyphicon glyphicon-calendar">
                </span>
            </span>
</div>

$(function () {
  $(".date").datetimepicker({
    startView: 2,
    minView: 2,
    forceParse: 0,
    view: 'years',
    format: 'yyyy-mm-dd'
   });
});

By giving f12 in

asked by Fercho Jerez 02.08.2016 в 17:58
source

2 answers

0

you could put the part where you add the libraries to your HTML.

I have the following locally

<script type="text/javascript" src="lib/jquery.js"></script>
<script type="text/javascript" src="lib/jquery-ui.min.js"></script>

And I add it in the following way:

$(".fecha").datepicker();
     $.datepicker.regional['es'] = {
        closeText: 'Cerrar',
        prevText: 'Anterior',
        nextText: 'Siguiente',
        currentText: 'Hoy',
        monthNames: ['Enero', 'Febrero', 'Marzo', 'Abril', 'Mayo', 'Junio', 'Julio', 'Agosto', 'Septiembre', 'Octubre', 'Noviembre', 'Diciembre'],
        monthNamesShort: ['Ene', 'Feb', 'Mar', 'Abr', 'May', 'Jun', 'Jul', 'Ago', 'Sep', 'Oct', 'Nov', 'Dic'],
        dayNames: ['Domingo', 'Lunes', 'Martes', 'Miércoles', 'Jueves', 'Viernes', 'Sábado'],
        dayNamesShort: ['Dom', 'Lun', 'Mar', 'Mié', 'Juv', 'Vie', 'Sáb'],
        dayNamesMin: ['Do', 'Lu', 'Ma', 'Mi', 'Ju', 'Vi', 'Sá'],
        weekHeader: 'Sm',
        dateFormat: 'dd-mm-yy',
        firstDay: 7,
        isRTL: false,
        showMonthAfterYear: false,
        yearSuffix: ''
    };
    $.datepicker.setDefaults($.datepicker.regional['es']);
} );
    
answered by 02.08.2016 в 18:18
0

Check that the id or class that you occupy in the input is the same one that you occupy in the script since in the script you put

$(".date")

Being that there is no date in the html that you show us

<div class='input-group date'>
   <input  type='text' id="date_ex" name="date_emi" class="form-control" />
            <span class="input-group-addon">
                <span class="glyphicon glyphicon-calendar">
                </span>
            </span>
</div>
    
answered by 02.08.2016 в 20:15