0

I've made a "more" button and whenever i click it, another upload input will be displayed. Problem is, once I add the <div>, then it stops working. Is there any way around this?

<html>
    <head>
    <script type="text/javascript">
    var instance = 1;
     
    function newUpload()
    {
    instance++;
    var newInput = document.createElement("INPUT");
    newInput.size = "12";
    newInput.name = "regPictures" + instance;
    newInput.type = "file";
    newInput.style.display = 'block';
    element = document.getElementById("btnAdd");
    document.getElementById("he").insertBefore(newInput, element);
    }
    </script>
    </head>
    <body>
    <form id="he">
    <div>
    <input name="regPictures1" type="file" size="12"/>
     
    <br/>
    <input type="button" id="btnAdd" value="More" onclick="newUpload();" />
    </div>
    </form>
    </body>
    </html>
2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by urtrivedi
0

set id for DIV not for FORM, as i did in following code

<form >
    <div id="he">
    <input name="regPictures1" type="file" size="12"/>
 
    <br/>
    <input type="button" id="btnAdd" value="More" onclick="newUpload();" />
    </div>
    </form>
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.