Important Notice: Our web hosting provider recently started charging us for additional visits, which was unexpected. In response, we're seeking donations. Depending on the situation, we may explore different monetization options for our Community and Expert Contributors. It's crucial to provide more returns for their expertise and offer more Expert Validated Answers or AI Validated Answers. Learn more about our hosting issue here.

How to toggle the day between 3 different states when being clicked?

clicked different toggle
0
10 Posted

How to toggle the day between 3 different states when being clicked?

0
10

It’s easy. Taking the HelloWorld demo as example, all you need is to add the following to the fAfterSelected in plugins.js: function fAfterSelected(y,m,d,e) { var evt=fGetEvent(y,m,d); if (evt==null) fAddEvent(y,m,d,”select-am”,””,”green”,null,null,null,null,1); else if (evt[7]==1) fAddEvent(y,m,d,”select-pm”,””,”blue”,null,null,null,null,2); else if (evt[7]==2) fAddEvent(y,m,d,”select-wholeday”,””,”gold”,null,null,null,null,3); else if (evt[7]==3) fRemoveEvent(y,m,d); // put your own code here to store the status of each selection fRepaint(); } Note that the above code only makes the calendar in your browser cycle through 3 different states, you’ll still need to add your own code in between to record the change (e.g. in a hidden form field) so ast to submit to backend server later.

Related Questions

What is your question?

*Sadly, we had to bring back ads too. Hopefully more targeted.

Experts123