Get Input Image Field - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Input Image


The Input Image object represents an HTML <input> element with type="image".

You can access an <input> element with type="image" by using getElementById():

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>

<input type="image" src='' id="myImage" >

<button onclick="myFunction()">test</button>

<p id="demo"></p>

function myFunction() {//  ww w  .  ja v  a2 m
    var x = document.getElementById("myImage").src;
    document.getElementById("demo").innerHTML = x;

Related Tutorials