I basically have a jQuery Datepicker. The Datepicker shows up but it doesn't seem functional as it does nothing when a day is selected. It doesn't work and previous and next are selected as well.
I get the "inst is undefined" error
-- the script
jQuery(function() {
jQuery("#datepicker1").datepicker();
});
-- the element
<input type="text" id="datepicker1" name="datepicker1"/>
I found the answer.
There is a part in the page that copies the form where the element datepicker1 is included. Thus, there were multiple "datepicker1" being generated. The datepicker gets confused with the multiple datepicker1 and perhaps gets the value of the one with no value at all.
I did a fix by naming my datepicker input uniquely
<?php $x++; ?>
<input type="text" id="datepicker<?=$x;?>" name="datepicker1"/>
If you have the same problem, you might just need to make sure that all your datepickers have unique id.
First, you have to define the instance before calling the date picker method.
Try this,
Instatiate the datepicker
$( "#datepicker1" ).datepicker();
Then call a method on it
$( "#datepicker1" ).datepicker("show");
If you just call it without instantiating it it will throw that error.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With