Hey friends, I'm facing a problem while dynamically generating <input type="file">
Here is the peice of javascript I'm using...
<script language="javascript" type="text/javascript">
var num = 1;
function add(){
num++;
image.innerHTML = image.innerHTML +"
<input type='file' name='image[]'>";
}
</script>
And the HTML div I'm using is...
<div id="image">
<input type="file" name="image[]"/>
Add
</div>
Now the Problem is, whenever I click "Add", an input type="file" field gets generated but resets other input type="file" field in that div.
I mean, say I've selected a file and then click "Add", a new input field gets generated the existing one gets resetted.
What is the solution?? Please help.
BTW I was wondering what's the diff b/w this two??
language="javascript" and type="text/javascript"
Here is the peice of javascript I'm using...
<script language="javascript" type="text/javascript">
var num = 1;
function add(){
num++;
image.innerHTML = image.innerHTML +"
<input type='file' name='image[]'>";
}
</script>
And the HTML div I'm using is...
<div id="image">
<input type="file" name="image[]"/>
Add
</div>
Now the Problem is, whenever I click "Add", an input type="file" field gets generated but resets other input type="file" field in that div.
I mean, say I've selected a file and then click "Add", a new input field gets generated the existing one gets resetted.
What is the solution?? Please help.
BTW I was wondering what's the diff b/w this two??
language="javascript" and type="text/javascript"