W
W
wolf-98302014-03-30 13:02:36
JavaScript
wolf-9830, 2014-03-30 13:02:36

How to change the picture?

How to change image in img tag in javascript?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
C
callback, 2014-03-30
@wolf-9830

In pure javascript

document.getElementById('myImage').src = '/path/to/img.jpg';

V
Vanya Ivanov, 2014-03-30
@mr_cloud

g.zeos.in/?q=C%D0%BC%D0%B5%D0%BD%D0%B0%20%D0%BA%D0...

P
Pavel Gogolinsky, 2014-03-30
@gogolinsky

How to change image on click (jquery)

$("img").on("click", function() {
    $(this).attr("src", "/path/to/new/img");
})

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question