জাভাস্ক্রিপ্ট দিয়ে HTML চাইল্ড নোড রিমুভ করার কোড নিচে দেওয়া হল:
উদাহরণ
<!DOCTYPE html>
<html lang="bn">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>চাইল্ড নোড রিমুভ</title>
<style>
body { font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif; }
.result { font-size: 20px; font-weight: 500; }
</style>
</head>
<body>
<h1>জাভাস্ক্রিপ্ট দিয়ে HTML চাইল্ড নোড রিমুভ করা</h1>
<div style="color: green;" class="result">
<ul class="animal">
<li>গরু</li>
<li>সিংহ</li>
<li>বাঘ</li>
<li>মহিষ</li>
</ul>
</div>
<button class="Btn">এখানে ক্লিক করুন</button>
<h3> উপরের লিস্ট থেকে প্রথম এলিমেন্ট রিমুভ করতে বোতামে ক্লিক করুন </h3>
<script>
const resEle = document.querySelector(".result");
const animalList = document.querySelector(".animal");
document.querySelector(".Btn").addEventListener("click", () => {
animalList.removeChild(animalList.childNodes[0]);
animalList = animalList;
});
</script>
</body>
</html>
আউটপুট
উপরের কোডটি নিচের আউটপুট দেবে:

'এখানে ক্লিক করুন' বোতামে ক্লিক করার পর:
