Date picker html5 tag is not working on Mozilla, IE browsers. But its working only on Chrome

26,609

Solution 1

Yes DatePicker tag of HTML5 is not supported by Mozilla Firefox. But you can use DatePicker in your website by adding few .js files.

Below is my fiddle using some .js files. this code work properly on Chrome as well as Mozilla.

<script>
$(function() {
$( "#datepicker" ).datepicker();

});
</script>
</head>
<body>
<p>Your Selected date Is : <input type="text" id="datepicker"></p>

http://jsfiddle.net/Vq65z/504/

Solution 2

You can user jQuery date picker in case of Mozilla: Check the browser using $.browser.mozilla but it will not work in jQuery>1.9, so you have to use jQuery Migration as shown below:

     <script src="http://code.jquery.com/jquery-1.10.2.js"></script>
      <script src="http://code.jquery.com/jquery-migrate-1.2.1.js"></script>//jQuery migration
    <script>
        if ($.browser.mozilla)
    {
        if ($('.datepicker')[0].type != 'date') $('.datepicker').datepicker();
        $(function () {
            $(".datepicker").datepicker({
                changeMonth: true,
                changeYear: true,
                yearRange: "1900:2015",
                dateFormat: "yy-mm-dd",
                defaultDate: '1900-01-01'
            });
        });
    }

</script>

Solution 3

Date is only supported in Chrome, Opera, Safari and Android Browser 4.4+

http://beta.caniuse.com/#search=date

Solution 4

1st, to answer the OP, what the asker is asking to do is impossible. Javascript is required. 2nd, although webshim looks great, it works horribly with bootstrap. For that you'll want to use http://eonasdan.github.io/bootstrap-datetimepicker/

Share:
26,609
user3801514
Author by

user3801514

Updated on November 25, 2020

Comments

  • user3801514
    user3801514 over 3 years

    I am trying to use HTML 5 Date picker tag in my website. But this tag is not supporting on Mozilla & IE. Can you please share me any hack to work this code in IE and Mozilla.

    I want to use only HTML5. i don't want to go for JavaScript.

  • user3801514
    user3801514 almost 10 years
    Eirenaios I am using this tag only, but i IE & Mozilla not supporting this tag. So can you tell me any css hack for this?
  • Suresh Karia
    Suresh Karia almost 10 years
    jQuery UI is only the way not html5
  • J0e3gan
    J0e3gan over 9 years
    Note that the OP said I want to use only HTML5. i don't want to go for JavaScript.
  • kleopatra
    kleopatra almost 9 years
    Note that link-only answers are discouraged, SO answers should be the end-point of a search for a solution (vs. yet another stopover of references, which tend to get stale over time). Please consider adding a stand-alone synopsis here, keeping the link as a reference.
  • Pardeep Jain
    Pardeep Jain almost 9 years
    ok i got it what you want to say. actualy i am New to stacoverflow that's y i dont know much about answering the questions of overflow. thanx for Suggestion #t3chb0t.