I'm using the jquery .html() method and although it works if I use it on dom ready, when I try to use it within a click event, it crashes the app.

I'm delegating events to a div#nav, and on click, some JS executes and I need to update the html of div#header h1. For some reason, the .html() part crashes. I've tried commenting out all the other code that's executing on click, but it still crashes the app. It also happens if I try .text() instead of .html()

Any help would be appreciated.