Reset file input

Reset file input

HI i have this form :

  1. <form method="POST" action="" name="myform">
  2. <div id="line1">
  3. <button id="delete1">Delete Row</button>
  4. <input type="file" id="filetoup1" name="myfile1" /><br>

  5. Nome:<input type="text" name="nome" id="nomeup2" value="">

  6. </div>
  7. <hr>
  8. <div id="line2">
  9. <button id="delete2">Delete Row</button>

  10. <input type="file" id="filetoup2" name="myfile2" /><br>

  11. Nome:<input type="text" name="nome" id="nomeup2" value="">

  12. </div>


  13. <input type="submit" name="submitted" value="invia"></form>
This is the js :

  1. $(document).ready(function() {
  2. $('#delete1').click( function(){
  3.   $('#filetoup1').val('');

  4. });
  5.   
  6.   $('#delete2').click( function(){
  7.   $("#filetoup2").val("");
  8. });

  9. });
Why when i click on delete , the page  refresh?

this is the code : jsfiddle