Code Renaissance is about building great teams and great software. By exploring best practices, team interactions, design, testing and related skills Code Renaissance strives to help you create the team and codebase that you've always wanted.

Quick Tip: JS Event Binding and the Call Stack

Here's a little tip to make your javascript easier to debug... when subscribing to an event always wrap your event handler in an anonymous function so you can see the binding in the callstack. For instance the anonymous functions below will show up in the call stack (and thus the call stack can take you to the wiring code):

$(document).ready( function () {

  function () {

But on the following calls (without the anonymous wrapper) all you'll see in the call stack is the jQuery or ASP.Net javascript that is doing the event handling:



Hope this helps.

0 - What do you think?: