We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

ejDatePicker is not a function

Thread ID:

Created:

Updated:

Platform:

Replies:

148637 Oct 28,2019 10:51 PM UTC Oct 30,2019 07:03 AM UTC JavaScript - EJ 2 3
loading
Tags: DatePicker
Jim Oliver
Asked On October 28, 2019 11:06 PM UTC

Hello,

I am using the Javascript DatePicker control.  I need to get the value of the control in javascript. The control displays fine and I can select a date, but when I run this line

var dateObj = $('#testinput').ejDatePicker("instance");

I get

Uncaught TypeError: $(...).ejDatePicker is not a function

Is this the correct call to get the selected date value?  If not, what should I be using?  I have tried everything I can think of but I still get the same error


JSFiddle here:


   








Sureshkumar P [Syncfusion]
Replied On October 29, 2019 09:42 AM UTC

Hi Jim, 
 
Greetings from Syncfusion support. 
 
We validated your requirement with shared code. We can get our instance using ej2_instances[0] method. Kindly refer the below code block. 
 
document.getElementById('btn').onclick = function () { 
    var dateObj = document.getElementById('datepicker').ej2_instances[0]; 
    console.log(dateObj); 
} 
 
 
We created s sample based on your requirement. please refer the sample: https://stackblitz.com/edit/p7gcce?file=index.js  
 
Regards, 
Sureshkumar P 


Jim Oliver
Replied On October 29, 2019 03:14 PM UTC

Yep, that works!

Can I suggest that you add this to the documentation?  Date pickers are great and all, but it there is no documentation for getting the data out of them they aren't much use.

thanks again!



Sureshkumar P [Syncfusion]
Replied On October 30, 2019 07:03 AM UTC

Hi Jim, 
 
Thanks for your update. We will consider this in our documentation section. 
 
Regards, 
Sureshkumar P 


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon