Day 3: BASIC DOM MANIPULATION
All JavaScript projects no matter the level are made up basic JavaScript concepts. I learnt this by reading through some codebase in this my 30Days of code focusing on Javascript. One of the concept I went about learning on and Mastering is DOM manipulation in Javascript. This are my notes on the 3rd Day put together in a writing.
Document Object Model:
According to the World Wide Web Consortium the definition of DOM is, "The W3C Document Object Model (DOM) is a platform and language-neutral interface that allows programs and scripts to dynamically access and update the content, structure, and style of a document."
The Parts of DOM:
Core DOM - standard model for all document types
XML DOM - standard model for XML documents
HTML DOM - standard model for HTML documents
The HTML DOM is used for working on the properties and state of a HTML document. The major operations in the HTML DOM is the get, change, add or delete HTML element. The HTML has the methods and properties for manipulation.
Basic Code Example,
var clock = document.getElementById("clock");
clock.innerHTML = "Time goes here";
In the above code getElementById is a method and innerHTML is a property.
This is just a beginner sharing notes with a beginner. For more references check out here.