Single Choice
Easy
QWhat would the following JavaScript code produce?
Head
function myFunction()
{
var x = document.getElementsByTagName("P").namedItem("Element");
alert(x.innerHTML);
}
Head
function myFunction() { var x = document.getElementsByTagName("P").namedItem("Element"); alert(x.innerHTML); }
ID: #5099
Javascript DOM & Event Handling MCQ
118 views
Question Info
#5099Q ID
EasyDifficulty
Javascript DOM & Event Handling MCQTopic
Your Answer
Choose the Best Option
Click any option to instantly check if you're correct.
Correct Answer
Explanation
The element with the given ID or name is returned by the namedItem() method in an HTMLCollection.
The same outcome can be achieved using a shortcut way.
Continue Practice
Share
Share This Question
Challenge a friend or share with your study group.
More from This Topic