0

My input type is like below:

<input type="text" placeholder="Students DOB"  class="inputText" name="txtPassword" id="txtPassword" onfocus="(this.type='date')"  >

In the output on the Android devices, the Calendar does not work on Android device 4.1.2 (Jellybean), but the Calendar works on Android device 4.2 (kitkat)..

John Franky
  • 1,012
  • 1
  • 14
  • 33
  • **Why** is your input type like that? Are you aware it (changing the `type`) doesn't work on at least some versions of IE? – T.J. Crowder Jun 23 '15 at 06:18
  • @T.J.Crowder if give a direct input type as date, it still does not work on this device. I have the place holder to get a Hint for the user.. can you suggest where i need to correct my code ? – John Franky Jun 23 '15 at 06:21
  • I wouldn't play games with `type`. Either use `date` or use `text`. If you feel the need to play games with `type`, do it by having two inputs and showing/hiding the relevant one. – T.J. Crowder Jun 23 '15 at 06:39
  • @T.J.Crowder, this time i used the code if ( $('#test')[0].type != 'date' ) $('#test').datepicker(); and still the calendar does not show up in the device – John Franky Jun 23 '15 at 07:02

1 Answers1

1

My suggestion would be to use drop downs for the date instead of going for the default date picker as it is a hybrid app you may face issues with the versions and platforms , and even the default date picker in windows won't work fine all the time

Ranjith Varma
  • 473
  • 3
  • 11
  • I was thinking, how will the DB accept the value of different dropdowns as date-time format to save in dB..what i need to do is, capture all vaues of the each dropdowns, save them in a format accepted by DB and then put it in DB – John Franky Jun 23 '15 at 07:43
  • Frankly yes you should just accept it as a string and change it into date format with the best optimised format it will be 2 or 3 lines of code you can use something like this: var cmpDate = dob_month + "/" + .dob_date + "/"+ dob_year; var dob = new Date(cmpDate); something like this – Ranjith Varma Jun 23 '15 at 07:47