JQuery code presents different result depending on browser

0

I'm using a <input type="datetime-local"> but unfortunately does not work in Mozilla.

So I thought I'd implement something to mask this problem, but for that I need to run a specific code for Mozilla.

My project uses Jquery and Materialize on Front End.

Thank you!

    
asked by anonymous 04.05.2018 / 16:38

1 answer

2

You can always use the date and time separately:

<input type="date"/><input type="time">

You can also play a little with css to manipulate the borders

input {  border: 1px solid; outline: none; }
.date { border-right: none; }
.time { border-left: none; }

div:hover input{
  border-color: dodgerblue;
}
<div><input class="date" type="date"/><input class="time" type="time"></div>

Since you are using jquery you can also embed a jquery plugin to help you

DateTimePicker

jQuery('#datetimepicker').datetimepicker();
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script><scriptsrc="https://cdn.rawgit.com/xdan/datetimepicker/master/build/jquery.datetimepicker.full.min.js"></script>
<link rel="stylesheet" type="text/css" href="https://cdn.rawgit.com/xdan/datetimepicker/master/build/jquery.datetimepicker.min.css"/ >


<input id="datetimepicker" type="text" >
    
04.05.2018 / 18:16