I am using jQuery's toggle() to show/hide table rows. It works fine in FireFox but does not work in IE 8.
.show()
/.hide()
work fine though.
slideToggle() does not work in IE either - it shows for a split second then disappears again. Works fine in FireFox.
My HTML looks similar to this
<a id="readOnlyRowsToggle">Click</a>
<table>
<tr><td>row</td></tr>
<tr><td>row</td></tr>
<tr class="readOnlyRow"><td>row</td></tr>
<tr class="readOnlyRow"><td>row</td></tr>
<tr class="readOnlyRow"><td>row</td></tr>
</table>
JavaScript
$(document).ready(function() {
$(".readOnlyRow").hide();
$("#readOnlyRowsToggle").click(function() {
$(".readOnlyRow").toggle();
});
});
Looks like this has been fixed in JQuery 1.4.
I had the same issue, but I found a nice workaround to make
toggle
/slideToggle
work in all browsers.and now the JS:
The result is that
slideToggle
works fine in all Browsers, except for IE8, in which will look a weird (messed up slide), but it will still work.I've noticed this as well. Likely you'll have to toggle a class on each td instead. Haven't tried this solution yet, so let me know!
For others - this is specific to IE8, not 6 or 7.
EDIT
Clearly you didn't try this as evidenced by the -1, as I just did with fine results (in my situation).
CSS
tr.hideme td { display: none }
JS
I've experienced this same error on tr's in tables. I did some investigation using IE8's script debugging tool.
First I tried using toggle:
This works in FF but not IE8.
I then tried this:
When I debugged this code, jquery always thought it was visible. So it would close it but then it would never open it back.
I then changed it to this:
That worked fine. jQuery's got a bug in it or maybe my html's a little screwy. Either way, this fixed my issue.
Upgrading to jQuery 1.4 fixes this, whilst I'm at it though, the only "fix" on this page which worked for me was Dough boy's answer:
Just encountered this myself -- the easiest solution I've found is to check for:
instead of
then act accordingly . .