Well done!
You have completed Changing HTML Element Content and Attributes Quiz!
Quiz Question 1 of 5
How would you correctly modify the src
attribute of an img
element with id="imgOne"
using JavaScript?
Choose the correct answer below:
-
A
document.getElementById("imgOne").src = "newImage.jpg";
-
B
document.getElementById("imgOne").setAttribute("img", "newImage.jpg");
-
C
document.getElementById("imgOne").setAttribute("src", "newImage.jpg");
-
D
document.getElementById("imgOne").src = "newImage.jpg";
ANDdocument.getElementById("imgOne").setAttribute("src", "newImage.jpg");
are correct.