BorisMoore/jsrender — Issue #48: Consider adding templateLoaded event
Author: pixelhobo
Created: 2011-12-13 21:34:39+00:00
State: open

I have found when working with jquery templates that there are a number of things that need to be bound after the template is rendered, for example click events or loading masks/watermarks on inputs. My solution to this was to wrap the template load call in a function which inserts the template name as an attribute to target DOM element and pass the original arguments, then use .live() to wire these behaviors if the template and event appears. For example:

$("[template*=#navigation]").live("template_loaded", function(e,templateName) { }

Is there an existing/different way to do this sort of behavior binding after template load that i may have missed? is firing some events off that we can subscribe to something you could consider in the future.