how do I get img src | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

how do I get img src

11th Jan 2021, 10:18 AM
Solomon Akachukwu[code Weiner]
Solomon Akachukwu[code Weiner] - avatar
2 Answers
+ 1
Its not clear what you want exactly ! You want to know the src of an img using JS or you want to display an img ? If you're asking The JS way : //target the img element first const img = document.querySelector("#myImg") //then simply get the src attr img.src
11th Jan 2021, 10:40 AM
Med Amine Fh
Med Amine Fh - avatar
0
Yes please describe your question in more detail.
11th Jan 2021, 10:46 AM
Chris Coder
Chris Coder - avatar