Not sure why this code is not working. When I click on the active link the text should switch and keep doing so all the time. This code just runs once and then the onclick has no effect. Example on JSFiddle. Could you please explain why this did not work with your solution shown?
<div id="imageId">Image A, <a id="imageB" href="#">Image B</a></div>
$(document).ready(function() {
$('#imageB').click(function(event) {
"use strict";
alert("imageB");
event.preventDefault();
$('#imageId').html("Image B, <a id='imageA' href='#'>Image A</a>").show();
});
});
$(document).ready(function() {
$('#imageA').click(function(event) {
"use strict";
alert("imageA");
event.preventDefault();
$('#imageId').html("Image A, <a id='imageB' href='#'>Image B</a>").show();
});
});