Matt6097125
Posts: 0
Joined: Tue Jul 30, 2013 6:56 pm

Javascript API and Datepicker don't work with jQuery

Is there some trick to get the Javascript API to work with the datepicker component. I'm using Appery('event_date') and then trying to run jQuery functions on it. For instance, Appery('event_date').css('background-color','red'); throws an error saying it can't find the css function. Similarly, the "find" function failed as well. Is there something I need to do to be able to get the input element for a datepicker?

(Ultimately, all I'm trying to do is set the default date to blank and I'm trying to do this through jQuery).

Thanks for the help

Matt6097125
Posts: 0
Joined: Tue Jul 30, 2013 6:56 pm

Javascript API and Datepicker don't work with jQuery

Hi Illya,

I think I may have diluted my question with that example.

I was wondering if I can use jQuery with the Appery Javascript API like it says in the documentation. I'm thinking the datepicker is a special exception where it's only using your API and not chaining jQuery.

Can you confirm whether or not I can use jQuery chained with the Appery function on datepicker components?

Thanks for the clarification.

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

Javascript API and Datepicker don't work with jQuery

Hi Matt,

Yes, you can.

Matt6097125
Posts: 0
Joined: Tue Jul 30, 2013 6:56 pm

Javascript API and Datepicker don't work with jQuery

Excellent. Can you tell what's wrong with the following syntax?:

Appery("event_date").css("background-color","red");

When I do this, I'm getting "TypeError: Appery(...).css is not a function".

This code works fine with a text component, so it must be something with the datepicker. I then tried wrapping the Appery object is jQuery and it's still not working.

$(Appery("event_date")).find("input").css("background-color","red");

What would be the proper syntax to make the datepicker input have a red background?

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

Javascript API and Datepicker don't work with jQuery

Hi Matt,

Please try the following: preAppery("event_date").datapickerRoot.css("background-color","red");/pre

Matt6097125
Posts: 0
Joined: Tue Jul 30, 2013 6:56 pm

Javascript API and Datepicker don't work with jQuery

There we go. The datepickerRoot brought back jQuery.

My apologies if this is all in the documentation, but I'm not finding anything about it. Do you know if there are any other funky widgets I should be aware of where one needs to access an additional property to pick up the jQuery object?

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

Javascript API and Datepicker don't work with jQuery

Hi Matt,

Here you can find the functions that are not documented: https://github.com/exadel-jqm-contrib...

Return to “Issues”