Let's say I have a scenario where I have a global plugin (or at least a plugin that binds to a wider array of events).
This plugin takes 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 additional live binding something like this:
$("input[type='checkbox']").live("click", function(){alert("ho");});
Within this scenario, the checkbox would ideally end up being bound to both live events.
What I'm seeing is that the change event fires as it should, and I'm alerted "yo". However, using this live click event, I never trigger it. However, using an explicit click binding, I DO hit it.
The easy workaround is to trigger a click event at the end of the live change handler, but this seems janky to me. Any ideas?
Note that this is using jquery 1.4.2 and only occurs in IE8 (I supposed 6/7 would too, but I haven't tested them).
an example (you'll 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>