0

I'm looking to see if there's anything that does this out there / someone has already done it and outsourced the code before I write the code myself.

I have the following date selection:

I want to make it so that when you select a month the correct amount of days for the month are automatically shown in the day drop down. My idea to do this myself is use JQuery to detect when a user selects a month and then manually .hide the select days that should not be there.

Anything else out there that does this?

5
  • Does it support the UI I'm trying to go with? The JQuery date picker standard UI simply drops a calendar below the input field. Commented Nov 22, 2015 at 22:12
  • no its different to the format you want. But used widely. But what you are looking to do would only take a few lines of code anyway. Commented Nov 22, 2015 at 22:35
  • Few lines of code? Please care to explain... Commented Nov 22, 2015 at 23:11
  • just use the change evt and hide the dates that arent needed. a really easy way to do this is to apply a css class to your date select, e.g. "jan" all dates shown, feb 29, 30,31 hidden (febleap 30,31) or just do it with js Commented Nov 23, 2015 at 0:58
  • Done it with JS using a switch method :) Commented Nov 23, 2015 at 10:19

1 Answer 1

1

You can solve this using HTML5 input type=date

<input type="date" />

Try it here Tryit Editor -W3Schools

Sign up to request clarification or add additional context in comments.

6 Comments

Looking to find a solution with my current UI
Which UI are you using? Twitter Boostrap?
I mean just the UI I've conjured up. Not using anything!
I understand. You dont want use a datepicker like this Datepicker for Bootstrap 3. I suggest to create the algorimt via jQuery.
Make sure you treat bissextile year, to give Feb a extra day. ;)
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.