Can someone tell me please why the following example work in Firefox but not in IE 8?
Only content_1 work correct in IE 8.
Thx vijey.
<script type="text/javascript">
$(function(){
$("#sortable").sortable({handle: '#dragable'});
});
$(function(){
var v;
$('div[id^="content_"]').hover(
function () {
v = $(this).attr('id');
$('#'+v+' #menu').show();
$('#'+v+' #dragable').show();
},
function () {
$('#'+v+' #menu').hide();
$('#'+v+' #dragable').hide();
}
);
});
</script>
<body>
<div id='sortable'>
<div id='content_1'>
<div id='menu' style='display:none;'>
<div>edit</div>
<div>add</div>
<div>delete</div>
</div>
<div id='content'>Content_1</div>
<div id='dragable' style='display:none;'>[drag]</div>
</div>
<div id='content_2'>
<div id='menu' style='display: none;'>
<div>edit</div>
<div>add</div>
<div>delete</div>
</div>
<div id='content'>Content_2</div>
<div id='dragable' style='display:none;'>[drag]</div>
</div>
<div id='content_3'>
<div id='menu' style='display: none;'>
<div>edit</div>
<div>add</div>
<div>delete</div>
</div>
<div id='content'>Content_3</div>
<div id='dragable' style='display: none;'>[drag]</div>
</div>
</div>
</body>
IDs must be unique within a page (html spec [1]); you have 2
#menu,#content, etc. Change them to e.g.<div class="menu">and your selector to.menu— that should work.Incidentally, you can simplify your hover callback with
find[2]:1: http://www.w3.org/TR/html401/struct/global.html#h-7.5.2
2: http://api.jquery.com/find/