Topic: Setting Value of MDB Select dynamically after page loads

therepairshack free asked 5 years ago


I am trying to set the value of an input field using mdb datepickerI have a drop down with options:Due on receiptNet 10Net 30Due on specified dateWhen you select an option, i use jquery to calculate a date using a starting point of the current date.

var $today = new Date(); 
var $days = //integer representing the number of days to add to current date
var $newDate = $today.addDays($days);

The previous datepicker I was using had a setDate function I could use to pass $newDate into and it would then format it based on the formatting set in the settings.

MDB Datepicker doesn't appear to have anything like this that I can see in the documentation.

My question is this, once I have a date created using jquery new date(), how do I set the input of the datepicker and have it format it correctly. I know how to set the val of the input with jquery, and that works but it's not formatting it correctly.



Please take a look at my snippet



Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Answered

Specification of the issue

  • ForumUser: Free
  • Premium support: No
  • Technology: MDB jQuery
  • MDB Version: 4.7.7
  • Device: mbp
  • Browser: chrome
  • OS: Mac OS X
  • Provided sample code: No
  • Provided link: No