Let's say I have a scenario where I have a global plugin (or at least a plugin that communicates with a wider array of events).
This plugin accepts a selector and binds a live click to it. Something in pseudo-jquery that might look like this:
$.fn.changeSomething = function(){
$(this).live("change", function(){ alert("yo");});
}
On another page, I have an extra live anchored something like this:
$("input[type='checkbox']").live("click", function(){alert("ho");});
In this scenario, the check box is ideal for both live events.
What I see is that the change event is triggered as it should, and "years" warn me. However, using this live click, I never launch it. However, using explicit click bindings, I do this.
An easy workaround is to fire the click event at the end of the real-time change handler, but that seems crazy to me. Any ideas?
Note that this is using jquery 1.4.2 and only happens in IE8 (I assumed 6/7 as well, but I haven't tested them).
example (you will need jquery-1.4.2.min.js):
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<script src="jquery-1.4.2.min.js" type="text/javascript"></script>
<script type="text/javascript">
$.fn.changeSomething = function(){
var t = $(this);
t.live("change", function(){
alert("yo");
});
};
$(document).ready(function(){
$("input[type='checkbox']").changeSomething();
$("#special").live("click", function(){
alert("ho");
});
});
</script>
</head>
<body>
<form>
<input type="checkbox" id="cbx" />
<input type="checkbox" id="special" />
</form>
</body>
</html>