0

I have a page , I need to Add a Picture from the web using it's URL and display it in my page same as the below image using Jquery or Javascript.

enter image description here

2 Answers2

0

You need to have a textbox where you can enter the url for the image and a button to attach an event.

var button = document.getElementById("button"),
    input = document.getElementById("input"),
    image = document.getElementById("image"),
    src;

// button click event
button.onclick = function(){
  // in case you want to use somewhere else
  src = input.value;

  // set the image src to the input value
  image.src = src;
}
<input id="input" type="text"/>
<button id="button">click me</button>
<img id="image" height="200px"/>
rssfrncs
  • 991
  • 4
  • 19
0
  • It just updates the image 'src' attibute and shows the image. and which is not saved ,and its not performing like input type ='file'.
Jayanth Suvarna
  • 187
  • 2
  • 9