شرح صفوف ومحتوى الفقرة
لكي نقوم بحذف Element معين من داخل ال Tree يجب عليك :
- اختيار ال Element عن طريق document.getElementById("idName")
- استخدام دالة ( ) remove
HTML
<!DOCTYPE html>
<html>
<body>
<div>
<p id="p1">This is a paragraph.</p>
<p id="p2">This is another paragraph.</p>
</div>
<button onclick="myFunction()">Remove Element</button>
<script>
function myFunction() {
var elmnt = document.getElementById("p1");
elmnt.remove();
}
</script>
</body>
</html>