Question 44Asked in Bihar STET 2025 Paper II Computer Science, 7 Nov 2025, Shift 1 (9:00 AM)

Which JavaScript method is used to add a new HTML element to the DOM?DOM में एक नया HTML तत्व जोड़ने के लिए किस JavaScript विधि का उपयोग किया जाता है?

DOM में एक नया HTML तत्व जोड़ने के लिए किस JavaScript विधि का उपयोग किया जाता है?
  1. AappendElement()appendElement()
  2. BcreateElement()createElement()
  3. CnewElement()newElement()
  4. DaddElement()addElement()
Show answerHide answer

Correct answer: (B) createElement()createElement()

Explanation

document.createElement() creates the new HTML element, which is then inserted into the page with appendChild() or append(). The other options are not standard DOM methods.document.createElement() नया HTML तत्व बनाता है, जिसे फिर appendChild() या append() से पेज में डाला जाता है। अन्य विकल्प मानक DOM मेथड नहीं हैं।

From Bihar STET 2025 Paper II Computer Science PYQ, 7 Nov 2025, Shift 1 (9:00 AM)

This is question 44 of Bihar STET 2025 Paper II Computer Science PYQ, 7 Nov 2025, Shift 1 (9:00 AM). See all questions of this paper with answers, or attempt the paper as a timed online test to get your score and all-India rank.