$("#removeMthod").remove();
$("#emptyMthod").empty();
▼정답
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
</head>
<body>
취미
<li>야구<input id="hobby" type="checkbox" value="baseball" /></li>
<li>농구<input id="hobby" type="checkbox" value="basketball" /></li>
<li>게임<input id="hobby" type="checkbox" value="game" /></li>
<br /><input
type="button"
onclick="hobbyHandler()"
value="결과보기"
/><br />결과값:
<h1 id="hobby-list"></h1>
</body>
<script>
function hobbyHandler() {
var hobby = document.querySelectorAll("#hobby[type=checkbox]:checked");
console.log(hobby);
document.querySelector("#hobby-list").innerHTML = "";
hobby.forEach(
(element) =>
(document.querySelector("#hobby-list").innerHTML +=
element.value + "<br>")
);
}
</script>
</html>