Well done!
You have completed Changing HTML Element Content and Attributes Quiz!
Quiz Question 1 of 5
When using the setAttribute
method to change an attribute, which of the following is a correct way to change the href
attribute of a link with id="refToSomewhere"
?
Choose the correct answer below:
-
A
document.getElementById("refToSomewhere").href = "https://en.wikibooks.org";
-
B
document.getElementById("refToSomewhere").setAttribute("href", "https://www.example.com");
-
C
document.getElementById("refToSomewhere").setAttribute("href", "https://en.wikibooks.org");
-
D
document.getElementById("refToSomewhere").setAttribute("href", "https://en.wikipedia.org");