Eliminate Interface Clutter With Arc90 Lab's Collapsible Panel! (As Seen On TV) | Home | Debugging Data Through the Console in ColdFusion 8

Filed under Quick Tips on March 17, 2008 by Corey Maass

Avoiding Repetitious Code in JQuery

A good tip in any coding language is to not repeat code. If you find yourself using a bit of code more than once, make it a separate function. In JQuery, you have the advantage of expanding the JQuery object to include your code. If you want to have the code process JQuery-selected items, use jQuery.fn.nameOfFunction. Otherwise, use jQuery.nameOfFunction. Finally, if you find yourself extending JQuery a lot, use jQuery.fn.extend and put all your code in one place.

1) JQuery extended function when you want to access a JQuery array of elements: Example use: 2) JQuery extended function: Example use:

Post a Comment Digg Del.icio.us

Trackback Pings (TrackBack URL for this entry)

http://www.arc90.com/cgi-bin/mt4/mt-tb.cgi/117.

Post a Comment:

Eliminate Interface Clutter With Arc90 Lab's Collapsible Panel! (As Seen On TV) | Main | Debugging Data Through the Console in ColdFusion 8