Hi!
I've simplified the HTML and Javascript.
The HTML structure
ul -> li -> a
The javascript
var $ul = $('#the-list');
$ul.find('a').click(function(e){
e.stopImmediatePropagation();
console.debug('a');
});
$ul.unbind('click').click(function(){
console.debug('ul');
});
The problem
The first time a link is clicked, everything works fine. But after the list content is updated with $ul.html(newHtml)
and the code above is run again, the event on $ul is called first.
First time:
- a
- Stops there
Second time:
- ul
- a
What would cause such a behaviour? Please excuse the reverse structure of this question