Solved MCQ on Scripting Documents in JavaScript set-5

1) The DOM defines a number of ways to select elements, by using which of the following methods we can query a document for an element or elements.

i) with a specified id attribute

ii) with a specified name attribute

iii) with the specified tag name

iv) with the specified CSS class or classes

A. i, ii and iii only

B. i, ii and iv only

C. i, iii and iv only

D. All i, ii, iii and iv



2) We can select an element based on unique ID with the ........... method of the document object.

A. getElementById()

B. getElementsById()

C. selectElementById()

D. selectElementsById()



3) The ......... attribute is only valid on a handful or HTML elements, including forms, form elements,