I have this script:
$('#ap').click(function() {
$('#content-container').html($('#alertpay').html());
return false;
});
Whenever someone clicks on #ap
, it will show the contents of #alertpay
in #content-container
.
However, how am I able to make a return link, so when users click it, it will show the original content from #content-container
? (The contents that were there.)
UPDATE I am trying with this code:
<div align="center" id="content-container">
<a href="#" id="ap">Show #alertpay</a>
</div>
<div id="alertpay" style="display:none">
#alertpay content here.
<a href="#" id="return-link">RETURN</a>
</div>
(function(){
var cchtml;
$('#ap').click(function(){
cchtml = $('#content-container').html();
$('#content-container').html($('#alertpay').html());
return false;
});
$('#return-link').click(function(){
$('#content-container').html(cchtml);
return false;
});
})();
The thing that does not work here, is when I press the RETURN anchor link. It doesn't do anything.