Which element has class="close" , the or something within the ?Airshow
Airshow
WiFi Lounge Lizard
2,679 posts since Apr 2009
Reputation Points: 321
Solved Threads: 372
Mmmmm, it's a bit diffult to interpret the ASPX.
Here's a simple test using longhand HTML/javascript, free of any ASPX/jQuery. I frequently do this sort of extract for cross-browser testing/development of awkward stuff.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>Airshow :: Untitled</title>
<style type="text/css">
{}
</style>
<script>
onload = function(){
var closeLinks = document.getElementsByTagName('a');
var msg = document.getElementById('message');
for(var i=0; i<closeLinks.length; i++) {
closeLinks[i].onclick = function() {
var p = this.parentNode;
var pp = p.parentNode;
//msg.innerHTML = p.parentNode.tagName + ' : ' + p.tagName
pp.removeChild(p);
//msg.innerHTML = pp.childNodes.length;
if(pp.childNodes.length === 0) { pp.style.display = 'none'; }
};
}
};
</script>
</head>
<body>
<div id="message"> </div>
<ul style="width:100px; border:1px solid #999;">
<li><a href="#" class="close">Item 1</a></li>
<li><a href="#" class="close">Item 2</a></li>
<li><a href="#" class="close">Item 3</a></li>
<li><a href="#" class="close">Item 4</a></li>
<li><a href="#" class="close">Item 5</a></li>
</ul>
</body>
</html>
Try commenting out the line if(pp.childNodes.length === 0) { pp.style.display = 'none'; } and you will see that (at least in IE6) the UL block still has some height even after the last LI has been removed. Hence hide it when its childNodes.length === 0 .
Once it's working, you can translate the code back into jQuery if you choose.Airshow
Airshow
WiFi Lounge Lizard
2,679 posts since Apr 2009
Reputation Points: 321
Solved Threads: 372
Which version of IE are you testing in?
Airshow
Airshow
WiFi Lounge Lizard
2,679 posts since Apr 2009
Reputation Points: 321
Solved Threads: 372
Seems like an IE8 bug then.
Have you tried Dsweb's suggestion to hide rather than remove the LI?
IE8 may do that OK.
Airshow
Airshow
WiFi Lounge Lizard
2,679 posts since Apr 2009
Reputation Points: 321
Solved Threads: 372
I'm sure you can still do that with hidden LIs.
Have you tried hiding to see if IE8 renders correctly with display='none' ?
I'm off-line for the next few hours. Have a play with it.Airshow
Airshow
WiFi Lounge Lizard
2,679 posts since Apr 2009
Reputation Points: 321
Solved Threads: 372
Tried not working./..I am sorry its actually its IE6 and IE7 not IE8 thats creating the prob...
My test/demo above works fine in IE6 and IE7. See if it does the same running on your computer.
If it works OK, then try changing your DOCTYPE to be the same as mine (XHTML 1.0 Transitional). DOCTYPE can make a difference with this sort of thing.Airshow
Airshow
WiFi Lounge Lizard
2,679 posts since Apr 2009
Reputation Points: 321
Solved Threads: 372