Reset file input
Reset file input
HI i have this form :
<form method="POST" action="" name="myform">
<div id="line1">
<button id="delete1">Delete Row</button>
<input type="file" id="filetoup1" name="myfile1" /><br>
Nome:<input type="text" name="nome" id="nomeup2" value="">
</div>
<hr>
<div id="line2">
<button id="delete2">Delete Row</button>
<input type="file" id="filetoup2" name="myfile2" /><br>
Nome:<input type="text" name="nome" id="nomeup2" value="">
</div>
<input type="submit" name="submitted" value="invia"></form>
This is the js :
$(document).ready(function() {
$('#delete1').click( function(){
$('#filetoup1').val('');
});
$('#delete2').click( function(){
$("#filetoup2").val("");
});
});
Why when i click on delete , the page refresh?
this is the code :
jsfiddle
Topic Participants
stefanobanchelli
jakecigar