You cannot use a thisvariable name as a name, and even if it is possible, this is probably not a good idea. I would make your code look like
$("button").click(function() {
var newSrc = $("button")[0].getAttribute("href");
$("#demo img").attr("src", newSrc);
});
/ , .on("load"... src . :
$('button').click(function() {
var newSrc = $("button")[0].getAttribute("href");
$(".loading-picture-gif").show();
$("#demo img").on("load", function() {
$(".loading-picture-gif").hide();
}).attr("src", newSrc);
});