Single Choice
Easy
QWhat would the following JavaScript code produce?
1
2
3
function myFunction()
{
var x = document.getElementsByTagName("P").item(0);
alert(x.innerHTML);
}
1
2
3
function myFunction() { var x = document.getElementsByTagName("P").item(0); alert(x.innerHTML); }
ID: #5097
Javascript DOM & Event Handling MCQ
102 views
Question Info
#5097Q 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 at the specified index in an HTMLCollection is returned by the item object. The function retrieves the HTML content of the document's first p> element.
Continue Practice
Share
Share This Question
Challenge a friend or share with your study group.
More from This Topic