JavaScript Program to Remove Child at Runtime

Write a JavaScript program to remove child at runtime.

Source Code

    <title>Remove Child at Runtime</title>
    <script type="text/javascript">
        function remove() {
            d = document.getElementById("mydiv");
            para = document.getElementById("msg");

    <input type="button" value="Remove Child" onclick="remove()" />
    <div id="mydiv">
        <p id="msg">Welcome to JavaScript</p>
        <p>Hello to all</p>
        <p>Bye to all</p>


"Coding Hub - Learn to code" app now available on Google Play Store