New program

<!DOCTYPE html>
<html>
<head>
 <title>DOM Examples</title>
</head>
<body>

Hello world

Hello world

Hello world

Hello world

Hello world2

Hello world3

[removed] const element=document.getElementsByTagName('p'); element[1].textContent="Updated paragraph"; const qselector=document.querySelector('#myp'); qselector.textContent="The updated query selector"; qselector.style.fontWeight="bold" const qclass=document.querySelector('.myp'); qclass.style.color='green'; const allsel=document.querySelectorAll('.mypp'); allsel.forEach(el => el.style.color='red'); const newElement=document.createElement('p'); newElement.textContent = "This is the new element Added in the DIV"; document.getElementById('mydiv').appendChiled('new'); [removed] </body> </html>

Leave a Reply