I'm really new to javascript
how do I make it that when I click a button
a number on my page in the <p> tag with
the Id of num gets 1 added to it
so it i like 2,3,4,5 each time I click

<html>
    <head>
        <script type="text/javascript">
            function add() {            
                //count number of label
                var ctr = document.getElementsByTagName("label").length;
                ctr = ctr + 1;  

                var newElement = document.createElement('label');
                if(ctr !== 1) {
                    newElement.innerHTML = ', ' + ctr;
                } else {
                    newElement.innerHTML = ctr;
                }               
                document.getElementById("result").appendChild(newElement);
            }
        </script>
    </head>
    <body>
        <div>
            <input type="button" onclick="add()" value="Click me" />
        </div>
        <div id="result">            
        </div>
    </body>
</html>
commented: This is clearly a homework assignment, and you just give him the code! Good job... +0

That works for me, I hope that could help you.