So, you have a page: <html><head> <script type="text/javascript" src="jquery.1.3.2.js"></script> <script type="text/javascript"> $(function() { var onajax = function(e) { alert($(e.target).text()); }; var onclick = function(e) { $(e.target).load('foobar'); }; $('#a,#b').ajaxStart(onajax).click(onclick); }); </script></head><body> <div id="a">foo</div> <div id="b">bar</div> </body></html>
Would you expect one alert or two when you clicked on 'foo'? I would expect just one, but i get two. Why does one event have multiple targets? This sure seems to violate the principle of least surprise. Am i missing something? Is there a way to distinguish, via the event object which div the load() call was made upon? That would sure be helpful...