I'm new to jQuery (after 5+ years of Prototype.js) so hopefully this is just a "schtupit newbie unlearn / relearn problem." TIA for any help helping me understand / fix this.
Broadly, I want to use .countdown to time out a form submission (there are several forms on the page, in case that's relevant to this). When the page loads the timers start and the user gets a (set of) "you have X time to answer this question" messages. When the time runs out, the submit button changes to a "too bad, so sad" image.
The timers are being started on the .ready state. I also tried waiting for .load but that also didn't work, though the behavior was different. I won't go into that strangeness at this point unless asked. Here's the code.
What happens (as seen via Firebug and the UI) is that onExpiry is firing immediately, not after the timer reaches 00:00:00. I get a (series of) alert dialogs and after clicking through them the timers run to 00:00:00, then nothing.
Sure would appreciate any help understanding what I'm doing wrong here.
Thank you very much for your help. I guess I need to go back and look at the documentation harder. The string notation I was using definitely gave the impression that it was correct (i.e., the count down worked visually) and I thought what I read said it was one of the ways the :until value could be specified. Changing it definitely did the trick though and the onExpiry is working as expected now.
The next piece that I needed to tackle had me a little worried in that the documentation in the code gave the impression that I wouldn't be able to pass arguments in to the function. Turned out that the element being expired was available as 'this' inside the function and from there it was easy to traverse the dom to show the 'too bad, so sad' image and hide the submit button.
Thanks again for your help I appreciate it very much.
Best regards, Bill
Leave a comment on bill_walton's reply
Change topic type
Link this topic
Provide the permalink of a topic that is related to this topic