Changing image attribute | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Changing image attribute

Please explain how to change image src attribute using document object My code: https://code.sololearn.com/W2oW3lnA0Waw/?ref=app Thanks in advance

27th Mar 2020, 2:40 PM
O.Naga Lakshmi Lalasa
O.Naga Lakshmi Lalasa - avatar
5 Answers
+ 3
O.Naga Lakshmi Lalasa your code is working perfectly. You just need a valid online url. Ore Adeleye's code is also fine.
27th Mar 2020, 5:02 PM
Kevin ★
+ 1
Thankyou so much.You've given everything i needed.
27th Mar 2020, 5:36 PM
O.Naga Lakshmi Lalasa
O.Naga Lakshmi Lalasa - avatar
0
el.setAttribute("src", "apple.png")
27th Mar 2020, 3:12 PM
Ore
Ore - avatar
0
Kevin image tag doesn't work for me all the time.Even if i give exact path of an image still image will not be displayed.can you please explain me syntax of image tag and an example in HTML?Thanks in advance.
27th Mar 2020, 5:10 PM
O.Naga Lakshmi Lalasa
O.Naga Lakshmi Lalasa - avatar