I am retriving this content from ajax
<div id="content">
click on image to close<img id="img_id">
</div>
jQuery code to close div:
$("#img_id").live('click',function(){
$("#content").slideUp('fast');
});
Once I click on image div closes. But in IE6 nothing happens. I don’t know why IE6 doesn’t take live click event, or if the problem is with image id.
Once image clicked (live click event not triggered in IE6) What would be the reason?
It works in simple tests (see below), even with IE6, so we’re looking at something specific to your page.
Thoughts:
1) IE, and particularly IE6, has issues mixing together namespaces, do you have anything on the page with the name “content” or “img_id” other than the above? Any global variables? The
nameattribute on a field?2) Are you absolutely sure the code setting up the
livehandler is being executed on IE? IE has issues with some syntax quirks that some other browsers don’t have (for instance, trailing commas in object literals), so you need to be sure the script is parsing correctly.Simple test, with no DOCTYPE (that doesn’t seem to make a difference one way or the other), no HTML5 shim, etc.:
HTML:
JavaScript:
Live copy * Live copy with DOCTYPE