How to write, run and save code
- then simply load the HTML file in the browser
- Now link this js file with the HTML document using script tage like:
either in the body or in the head.
The above CSS code only targets two element ‘a’ and ‘div’ element whose ID is ‘plain’.
Output: (Before Clicking anywhere on div)
Output: (After Clicking anywhere on div)
Learning from the Code
- Page is known as document for the purpose of scripting in a web page.
- Properties of the document can be referenced by writing document followed by a dot, followed by the property name. The document has lots of properties.
The above code is a decent example of how we should make a directory, how to link different types of code files with each other and how to write simple yet effective code.