$('#a').find('.foo, .bar').live('click', function(event){ alert('clicked a -> foo/bar'); });
$('#b').find('.foo, .bar').live('click', function(event){ alert('clicked b -> foo/bar'); });
//]]></script>
My expected outcome is:
1. click on any "foo" or "bar" div above and receive one alert
Actual outcome is:
2. clicking on the first div is fine, but the other three produce two alerts (one from each .live() call)
Note:
I realise I can change the selectors to be like "#a .foo, #a .bar", but this is isolated test code; the actual code in the project I am working is a bit more complicated, e.g.: