Almost giving up after 2 days… .fadeOut() with jQuery 1.7.1 + IE9 does not work on the <tr> element. Can anyone else confirm if this is a known issue? Works in FF and Chrome.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<script type="text/javascript" src="http://www.google.com/jsapi"></script>
<script type="text/javascript">google.load("jquery", "1.7.1");</script>
<script type="text/javascript">
$("document").ready(function() {
$("a.delete").click(function() {
$(this).parent().parent().fadeOut();
return false;
});
});
</script>
<style>
a, td { background-color: #ececec; padding: 5px; }
</style>
</head>
<body>
<table>
<tr><td><a class="delete" href="#">delete</a></td><td>apple</td></tr>
<tr><td><a class="delete" href="#">delete</a></td><td>orange</td></tr>
<tr><td><a class="delete" href="#">delete</a></td><td>pear</td></tr>
</table>
</body>
</html>
EDIT: This updated code below will reveal more information about the issue. I found out that if your mouse moves away from the <tr> after click the <tr> will fadeOut correctly i.e. update its style
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<script type="text/javascript" src="http://www.google.com/jsapi"></script>
<script type="text/javascript">google.load("jquery", "1.7.1");</script>
<script type="text/javascript">
$(document).ready(function() {
$("a.delete").click(function() {
$(this).parent().parent().fadeOut();
return false;
});
$("a.show").click(function() {
$("tr").fadeIn();
})
$("a.delete-tr").click(function() {
$("tr").each(function(i, e) {
if($(e).css("display") != "none") {
$(e).fadeOut();
return false;
}
});
})
});
</script>
<style>
table { background-color: red; }
a, td { background-color: #ececec; padding: 5px; }
</style>
</head>
<body>
<p><a class="show" href="#">show</a></p>
<p><a class="delete-tr" href="#">delete row</a></p>
<table>
<tr><td><a class="delete" href="#">delete</a></td><td>apple</td></tr>
<tr><td><a class="delete" href="#">delete</a></td><td>orange</td></tr>
<tr><td><a class="delete" href="#">delete</a></td><td>pear</td></tr>
</table>
</body>
</html>
For reasons I do not understand (quirks with table rows in IE, I guess), the
fadeOut()of the<tr>will work if you initially set it’s opacity to 0.99 with a CSS rule. You can see it work in IE9 here:http://jsfiddle.net/jfriend00/ZMunQ/
This is obviously a hack/work-around, but seems to work.
My guess would be that jQuery is using filter for the opacity setting (required for older versions of IE) and filters have a different effect on child objects than standard opacity.
Here’s another work-around (less hackish that the earlier work-around) which works in IE9 (fade out the td tags instead and hide the tr at the end of the fade):
You can see it in action here: http://jsfiddle.net/jfriend00/ZMunQ/8/