Hi All,
I have a question on how to update my div. I am importing the Unsplash Api and would like to randomly generate a picture. Its working but only for the first time I click the button.
Thanks for some advise on what to change or what function will be able to reload the div. I already tried with location.reload but it only works for the whole site.
Thanks a lot!
<script>
function myFunction2() {
var photo = new UnsplashPhoto();
var testArr = [];
testArr = photo.fetch();
console.log("url:" + testArr);
document.getElementById("myImg").src = testArr.toString();
}
</script>
div class="myUnsplash">
<img class="img-responsive img-thumbnail" id="myImg" src="#" alt="Random Unsplash Picture">
</div>