DOM API would be the best bet for achieving the mentioned functionality to update content dynamically
What is DOM API?
By storing the structure of a document—such as the HTML encoding a web page—in memory, the Document Object Model (DOM) links web pages to scripts or programming languages and helps to update content dynamically. Despite the fact that modeling HTML, SVG, or XML documents as objects is not a function of the core JavaScript language, it usually refers to JavaScript.
A logical tree is used by the DOM to represent a document. Every node in the tree, where each branch of the tree ends, is home to objects. Programmatically, the tree can be accessed via DOM methods. They enable you to alter the document's content, style, or organization.
Using DOM API dynamically:
The DOM provides methods for obtaining and modifying elements as well as for handling events by affixing event handlers. These are the techniques:
A document's event handler is attached by the addEventListener() function.
A node from another document is adopted by adoptNode().
The document that was previously opened with the document's output writing stream is closed with the close() function.
open()
Hence using the DOM API we can update content dynamically
Follow this link to know more about API
https://brainly.com/question/16792873
#SPJ4