1.What is dom?
Dom stands for
D - Document
O - Object
M - Model
Dom is a programming interface for html documents.It represents the page as a tree of objects,so JavaScript can manipulate structure, style, and content dynamically.
2.What is difference between dom and html?
DOM
Dom is a tree-like object model.Represents the current state for interaction.Dynamic; it updates in real-time.Manipulated by JavaScript to change the page.
HTML
Html is a markup language.Defines the initial structure and content.Static; it doesn't change once sent.Written by developers, read by browsers.
3.what is difference betweenand getelementbyid and queryselector?
getelementbyid:
Only ID strings (e.g., 'myID').Single element matching the ID.Faster directly accesses the element by ID.Faster; directly accesses the element by ID.
queryselector
Any CSS selector (e.g., '#myID', '.myClass', 'div > p').The first element matching the selector.Slightly slower must parse CSS selectors.Available on document and any individual element.
4.How to change the content of HTML elements
output
after click



Top comments (0)