Document Object Model
Document Object Model
head body
title h2 p a
“test.html”
“Link”
<html>
<head>
<title>Hello, world</title>
Document Object Model </head>
<body>
<h2>Here’s my page</h2>
<p>World, hello</p>
document <a href=“test.html”>Link</a>
</body>
</html>
html
head body
title h2 p a
“test.html”
“Link”
<html>
<head>
<title>Hello, world</title>
Document Object Model </head>
<body>
<h2>Here’s my page</h2>
<p>World, hello</p>
document <a href=“test.html”>Link</a>
</body>
</html>
html
head body
title h2 p a
“test.html”
“Link”
<html>
<head>
<title>Hello, world</title>
Document Object Model </head>
<body>
<h2>Here’s my page</h2>
<p>World, hello</p>
document <a href=“test.html”>Link</a>
</body>
</html>
html
head body
title h2 p a
“test.html”
“Link”
<html>
<head>
<title>Hello, world</title>
Document Object Model </head>
<body>
<h2>Here’s my page</h2>
<p>World, hello</p>
document <a href=“test.html”>Link</a>
</body>
</html>
html
head body
title h2 p a
“test.html”
“Link”
<html>
<head>
<title>Hello, world</title>
Document Object Model </head>
<body>
<h2>Here’s my page</h2>
<p>World, hello</p>
document <a href=“test.html”>Link</a>
</body>
</html>
html
head body
title h2 p a
“test.html”
“Link”
<html>
<head>
<title>Hello, world</title>
Document Object Model </head>
<body>
<h2>Here’s my page</h2>
<p>World, hello</p>
document <a href=“test.html”>Link</a>
</body>
</html>
html
head body
title h2 p a
“test.html”
“Link”
<html>
<head>
<title>Hello, world</title>
Document Object Model </head>
<body>
<h2>Here’s my page</h2>
<p>World, hello</p>
document <a href=“test.html”>Link</a>
</body>
</html>
html
head body
title h2 p a
“test.html”
“Link”
Document Object Model
• The document object itself, as well as all of the objects
contained within it, have a number of properties and a
number of methods that can be used to drill down to a
very specific piece of your website.
document.getElementById(‘colorDiv’).style.backgroundColor = ‘green’
Document Object Model
• jQuery
document.getElementById(‘colorDiv’).style.backgroundColor = ‘green’
Document Object Model
• jQuery
$(‘#colorDiv’).css(‘background-color’, ‘green’);
Document Object Model
• jQuery
https://api.jquery.com