Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

appendChild

<!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>
    <ul id="main">
        <li>apple</li>
    </ul>

    <script>
        let ans=document.getElementById("main");

         let element=document.createElement("li");
         element.innerText="nemani";
         
         ans.appendChild(element)

    </script>
</body>
</html>
Source by dev.to #
 
PREVIOUS NEXT
Tagged: #appendChild
ADD COMMENT
Topic
Name
9+8 =