Hi my friendly computer wizards!
I coded a simple datepicker in jQuery, the already finished packages was to heavy for my taste. I thought everything was a-ok until I noticed strange behaviour. I first decided it might have been the alcohol messing up the latency between my eyes and my brain, but when, after waking up, the problem persisted I decided to find help.
When I repeatedly click one of the arrows to change month, the script
starts to lagg behind and eventually stalls. After a while it comes
back to life. Approximately the first four or five month-changes work
as intended.
I have been trying to simplify the Date() calls to the best of my limited knowledge, but to no avail. Do I have some kind of memory leak?
I fiddled up an example that replicates the problem here (complete code): http://jsfiddle.net/DCfMj/
Any help is appreciated. It is also okay to say that I have written immensly crappy code and that I am a worthless sack of blood because of it. Constructive criticism like that builds character.
Every time you call
$(...).datepicker, you’re adding anotherclickhandler.Eventually, it starts taking a long time to run all of those handlers.