[Web] Relationship between HTML and JavaScript Objects
Relationship between HTML and JavaScript Objects
Explanation
Web pages typically have 2 parts:
- HTML: to create the structure and content
- JavaScript: to control behavior and interactivity
Some specific parts of HTML are identified, and JavaScript objects are created connected to these elements. These elements are handled and updated vis the JavaScript object.
Example
<HTML>
<div id="example">
Click me!
</div>
<JavaScript>
const element = document.getElementById('example');
element.onclick = function() {
element.innerText = 'Clicked!';
};
Comments
Post a Comment