I have 2 possible images to show. If the first one exists, show it; if not, show the second one
This code will be shown in multiple pages so if the first image doesn't exist, it shows it src either as "undefined" or "unknown" So I need to specify this 2 instances
I was trying the following, but as soon as I add the "or unknown" it breaks:
<div id="section-heading">
<div id="topBannerG" class="groupImageHidden">
<img src="(unknnown)">
</div>
<div id="topBannerG" class="groupImageHidden">
<img id="ctl00_ctl26_imgBanner" src="image.jpg">
</div>
</div>
$(document).ready(function() {
var imageDef = $("#topBannerG.groupImageHidden img");
if (typeof imageDef == "undefined") || (typeof imageDef === "unknown") {
var imgHref = $('.groupImage img').attr("src");
$('#section-heading').prepend('<div id="topBannerG" class="mslwidget maxWidth groupImage"><img src="' + imgHref + '" style="border-width:0px;"></div> ');
} else {
var imgTopHref = $('#topBannerG img').attr("src");
$('#section-heading').prepend('<div id="topBannerG" class="mslwidget maxWidth msl-pagebanner"><img id="ctl00_ctl26_imgBanner" src="' + imgTopHref + '" style="border-width:0px;"></div> ');
}
});