Professional Documents
Culture Documents
Ips 13 3 2024
Ips 13 3 2024
Ips 13 3 2024
<!DOCTYPE html>
<html>
<head>
<title>DOM Exercise</title>
</head>
<body>
<div id="container">
<p>This is a paragraph.</p>
<ul>
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
</ul>
</div>
</body>
</html>
Exercise 2
<!DOCTYPE html>
<html>
<head>
<title>DOM Exercise</title>
</head>
<body>
<div id="container">
<button id="submitButton">Submit</button>
<p id="greetingMessage"></p>
</div>
</body>
</html>
1. When the user clicks the "Submit" button, retrieve the value entered into the text input.
2. Use the retrieved value to update the text content of the <p> element with the id
"greetingMessage" to say "Hello, [name]!" where [name] is the value entered by the user.
Exercise 2
<!DOCTYPE html>
<html>
<head>
<title>DOM Exercise</title>
</head>
<body>
<div id="container">
<ul id="list">
<li>Apple</li>
<li>Orange</li>
<li>Banana</li>
</ul>
</div>
</body>
</html>
1. When the "Remove First Item" button is clicked, remove the first <li> element from the <ul>
element with the id "list".
2. Ensure that the removal of the first item does not cause any errors if the list is empty.