18Jun/110
JQuery dynamic event handler
I came to the conclusion that dynamic event handlers can make my life much more easier, so I can write more cleaner and maintainable code. My idea was to add different class names to an element to bind different event handlers to it. This way, I could get rid of some global variables and switch case loops that i needed to manage my functions. The second advantage is, that you can chain event handlers to do things one after another.
Here is a small example that adds classnames to a button and binds dynamic event handlers to the class attribute. Depending on the class attribute an event handler fires an alert box that indicates which classname was added to the button.
Impressum
Letzte Beiträge
- DIY CNC Fräse – The Milling Project – Elektronik – Part 2
- DIY CNC Fräse – The Milling Project – Part 1
- Step aside commandline, this is a job for Powershell
- Drive Max7219/Max7221 with common anode displays
- Publisher 2010 PTXT9.DLL problem – solution
Kategorien
- Allgemein (20)
- Business (10)
- Coding (18)
- .NET (3)
- AutoIt (2)
- JQuery (5)
- Powershell (3)
- Scripting (4)
- Elektronik (15)
- AVR – Küchenbeleuchtung (9)
- AVR – Misc (3)
- Hobby (16)
- YDR Tools (4)
Archive
- Mai 2013 (2)
- April 2013 (1)
- Februar 2013 (1)
- Dezember 2012 (1)
- Oktober 2012 (1)
- Juni 2012 (1)
- Mai 2012 (2)
- April 2012 (1)
- März 2012 (1)
- Februar 2012 (1)
- Oktober 2011 (2)
- September 2011 (1)
- August 2011 (4)
- Juni 2011 (3)
- Mai 2011 (1)
- Dezember 2010 (2)
- April 2010 (1)
- März 2010 (1)
- Februar 2010 (2)
- November 2009 (1)
- Oktober 2009 (8)
- August 2009 (2)
- April 2009 (1)
- März 2009 (1)
- November 2008 (1)
- Oktober 2008 (1)
- Juli 2008 (1)
- Mai 2008 (1)
- April 2008 (6)