-
Jun 14th, 2016, 09:42 AM
#1
Thread Starter
Fanatic Member
jQuery/Bootstrap Datepicker issue
I made a fiddle showing an issue I've been having. When a modal is shown, I am populating a field with a value. On shown, I'm actually querying mysql database and populating fields. The fiddle just shows it being populated with a sample date to show my issue.
After the modal is shown, when the user clicks on the date field, the filled date doesn't show up in the calendar by default and it will disappear if clicking away from the calendar. It will reappear by clicking on the input again.
I just want the datepicker to show the selected date of whatever date is filled in the field on modal shown.
https://jsfiddle.net/michels287/tt9yt8j0/
-
Jun 14th, 2016, 01:29 PM
#2
Re: jQuery/Bootstrap Datepicker issue
To pre-select the date on the calendar, use setDate and the date value instead of using Val().
Sample Logic.
JavaScript Code:
$('#date-field').datepicker('setDate', '02/12/2016');
-
Jun 14th, 2016, 01:57 PM
#3
Thread Starter
Fanatic Member
Re: jQuery/Bootstrap Datepicker issue
Thanks for helping me.
The modal form will be filled dynamically. So, how do I set the date if there's a date in the input, otherwise don't set the date and just use datepicker normally?
I have many datepickers on the form. I am using classes of '.datepicker' for each input.
-
Jun 14th, 2016, 02:11 PM
#4
Re: jQuery/Bootstrap Datepicker issue
I just recognized an issue here:
should be:
Note: small c does make a difference
Last edited by KGComputers; Jun 14th, 2016 at 10:04 PM.
-
Aug 31st, 2016, 12:56 AM
#5
New Member
Re: jQuery/Bootstrap Datepicker issue
Good catch KGcomputers. small c , it worked
-
Aug 31st, 2016, 10:59 AM
#6
Re: jQuery/Bootstrap Datepicker issue
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|