I am using MVVM to render a master template and within that I am rendering a child template using the data-template attribute. The child template contains some html that I attach an event to via jQuery.
I'm running into an issue where the event no longer fires in the child template after an update to the model.
My real-world implementation is more complex but I have thrown together a simple example of the issue here:
To reproduce the problem:
1. Click "I always work" notice the alert appears
2. Click "I stop working after updating input" notice the alert appears
3. Change the value of the input text
4. Click "I always work" and notice the alert is still working
5. Click "I stop working after updating input" and notice the alert no longer appears
Is this behavior expected?