-
Identifying the DOM
-
Focusing on key terminology/methods used in DOM manipulation
-
Access, add, alter and remove DOM elements
- DOM stands for Document Object Model
- When does the DOM get created? When HTML is being loaded from a server, the browser takes the HTML and converts it to the DOM
- It is a programming interface of your HTML or XML that is created by the browser
- Offers a web page as a tree of objects
- We use JavaScript with the DOM to make cool things happen!
- The DOM is a tree of nodes and each node has its own properties and methods
- What is a node? Anything we can change in the document: element, Text, HTML attributes
- These nodes also have relationships to one another
- Element relationships can be really useful for traversing the DOM. This means accessing elements from other elements
document.getElementById()
- accepts id as an argument
- returns first match
document.querySelector()
- returns the first value that matches the provided selector.
- This selector accepts tag names, class names and id’s
document.getElementsByClassName()
- accepts class as an argument
- returns an HTMLcollection
document.getElementsByTagName()
- accepts tag name as an argument
- returns an HTMLcollection
document.querySelectorAll()
- returns a node list that matches the provided selector
- If moving down the tree, we can use:
.children
,.querySelector
,.querySelectorAll
- If moving up, we can use
.parentElement
or.closest
- We can also traverse sideways
nextElementSibling
,previousElementSibling
document.createElement()
innerHTML
- difference between
+=
and=
.innerText
: Will only return human readable text.textContent
: Will return text as well as associated elements like span, style
.remove()
dom_manipulation's Introduction
dom_manipulation's People
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.