I'm using jQuery (in an ASP.Net 2.0 website written in C#, FWIW) to handle a fairly simple div expansion and image swap (for display state indication) and it's working like a charm in FF 3.5.5 but failing in IE 7, and I'm wondering if you fine folks might be able to help me ascertain why that would be.
I'm loading jQuery 1.3.2 from google code, finding some elements in the dom, toggling visibility on a few and then changing the source attribute of the displaystate image. Adding an alert of the displaystate image's src attribute in Firefox results in what I would expect, but in IE it's undefined.
Relevant code snippet follows:
<script language="javascript" type="text/javascript">
google.load("jquery","1.3.2");
</script>
<script language="javascript" type="text/javascript">
$(document).ready( function() {
$(".prodDownloadSection").click( function() {
var $catName = $(this).attr("id");
var $sectionName = $catName.substr(0,$catName.length-3);
var $productContainerDiv = $("#"+$sectionName);
$catDisplayState = $("#"+$sectionName+"displayState");
$productContainerDiv.slideToggle();
$productContainerDiv.toggleClass("selected");
$displayState = $productContainerDiv.prev("li").find("img.displayState");
alert($displayState.attr("src"));
if( $displayState.attr("src") == "img/placeholders/arrow-closed.gif") {
$displayState.attr("src", "img/placeholders/arrow-open.gif");
} else {
$displayState.attr("src", "img/placeholders/arrow-closed.gif");
}
});
});
</script>
There are no javascript errors, and the image in in place on the server, IE just doesn't even recognize the src attribute and so the if clause never evaluates to true.
Anyone have any ideas why I might not be getting the src of that image in IE?