Does the template depend on subscriptions and/or use Template.subscriptionsReady()? onRendered fires before subscriptions are ready, therefore manipulating elements that depend on those subscriptions with jquery in onRendered will fire too early and find nothing.
Try removing the self here. Iâve sometimes had problems where plugins were not registered on the template instanceâs jQuery object, just the global one.
Hi kenken, thanks for replying. Basically the problem is that any jquery selector within a #with doesnât work, the example below would be a typical edit form, there is no problem with similar code for a insert form which doesnât have the #with. I hope this will re-jog your memory because this is driving me nuts as to why it doesnât work, iâve also tried many other suggested alternatives but they havenât worked, i.e. afterflush, defer, etc. It seems more of a problem to do with the #with than anything else. Simplified code below:-
Now i tends to split the calendar input into its own template passing in the data and reuse the template whenever possible. But the hack of setTimeout() still works, normally i set 10-100ms.
setTimeout() set to 100ms is working, I understand spitting it out into a separate template should work as this will remove the #with. many thanks for helping me resolve it, much appreciated.