<!DOCTYPE html>
<html lang="ru">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Работа с содержимым элементов в jQuery</title>
<link rel="stylesheet" href="styles.css">
<script src="/js/jquery-3.6.0.min.js"></script>
<script src="scripts.js"></script>
</head>
<body>
<div> </div><br>
<input type="text" value=""><br>
<button id="myButton">Нажми меня</button>
</body>
</html>
window.onload = function()
{
document.getElementById('myButton').onclick = function()
{
$('div').html("<ul><li>Пункт 1</li><li>Пункт 2</li></ul>")
setTimeout(function()
{
$('div').text('Привет, мир!');
}, 1000);
setTimeout(function()
{
$('input[type="text"]').first().val("Введите логин");
}, 2000);
setTimeout(function()
{
alert($('div').html());
}, 3000);
};
};
Результат выполнения задания можно посмотреть
здесь.