Here’s my jQuery snippet
$(document).ready(function() {
$("#button").click(function(e) {
$("body").append('Source:CIA World Factbook');
});
});
I want to append only once by clicking on a button,
Here’s the source for the button,
<div id="button"> Show Sources </div>
How can I achieve it?
.one()will execute the click event just one time.Read more about
.one()