White screen on transition whilst changing an image.

White screen on transition whilst changing an image.

Hi, I am trying to change an image using this code prior to transition from a page:

a3 = "red_x.png";
$('#red>div>span>img').attr('src', 'assets/images/app/' + a3 + '.png' );
But I get a white screen on transition:

However if I use the code like this, it works fine,

$('#red>div>span>img').attr('src', 'assets/images/app/red_x.png' );

Has anyone any suggestions as might may be causing this.

Thanks,