Good morning sir. I want to change src attribute value. I do getElementById with id msrc. Thanks you sir. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 1

Good morning sir. I want to change src attribute value. I do getElementById with id msrc. Thanks you sir.

change src with JavaScript. https://code.sololearn.com/WDUY6LfYW6lI/?ref=app

30th Dec 2021, 12:56 PM
Malick Diagne
Malick Diagne - avatar
1 Answer
+ 1
<!DOCTYPE html> <html> <head> <title>change p and img</title> </head> <body> <p id="image"><button onclick="fun()">click me</button></p> <img id="msrc" src="https://mimo.app/i/panda.png"> <scrip> function fun() { document.getElementById ("image").innerHTML = 67; document.getElementById ("msrc").src = "https://mimo.app/i/kittles.png"; } </scrip> </body> </html> edit: change tag scrip to script spelling in above code.
30th Dec 2021, 1:02 PM
Jayakrishna 🇮🇳