JQuery Datepicker disable onload()

How to disable the jquery datepicker element on load of a page?
(i.e while initializing the datepicker the field should be disabled, not hidden)
p_ashwinramAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

hieloCommented:
assuming that the date picker element has id='elementID':

$(function(){
  $('#elementID').attr("disabled","disabled");
});
0
StealthyDevCommented:
Hi, give a try with this:

$( ".selector" ).datepicker({ disabled: true });

Regards.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
p_ashwinramAuthor Commented:
I appreciate both of you for taking your time out to reply to my post.

The above two solutions would work fine when the page is already loaded. My scenario requires the datepicker to be disabled on LOAD of the page. The disable event of datepicker did not work on load because the method is trying to act on the dom element which has not yet loaded completely.

I tried firing the disable event in both ways (after document.ready() and after onload). In both cases the datepicker element was not found to act upon.

As a temporary fix i have used setinterval and clearinterval methods to keep checking if the datepicker is loaded and then fire the disable event.
It is a very bad patch as it involves time delay.
So I am hoping someone can come up with a more efficient way to fix this. Any thoughts?
0
StealthyDevCommented:
Can you give the link to your datepicker?
0
p_ashwinramAuthor Commented:
I have to create a public page with the same functionality and expose it to you. I will do that in this week. Again thanks for the helping hand(s).
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JavaScript

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.