Answer the question
In order to leave comments, you need to log in
How to implement automatic image loading?
There is a code that allows you to download an image after copying the url to the input. Tried to insert url after page load in input . But, something is not working ... Tell me how to do it right?
Here is the code:
<input placeholder="Введите урл картинки" autofocus type="text" id="myinput"/>
window.onload = function () {
document.querySelector('input').addEventListener('input', function () {
var link = document.createElement('a');
link.href = this.value;
link.download = 'yandex.png';
link.click();
}, false);
var str = $("#myinput").val()
var leed = "http://media.kg-portal.ru/images/shrek3/shrek3_46.jpg"
$("#myinput").val(leed)
};
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question