0

Hi I need some help I am making a travel diary with some help i have managed to upload some information through a form.

What I want to do now is split this code. I want to spilt it in 2 pages 1 page where you can upload information en the other page where the information will display

The Form :

<form id="form" method="post" action="#">

        Titel:
        <input id="title" name="title" type="text"  />

        Onderschrift:
        <input id="message" name="message" type="text" />

        foto:
        <input id="file" name="file" type="file" />

        <input id="voegtoe" type="button" value="Toevoegen" />

        <button id="verwijder">Verwijder</button>
</form>

Javascript:

       $('#voegtoe').click(function () {
        var Title = $('#title').val();
        var Message = $('#message').val();
        var pic = document.getElementById("file").files[0];
        var imgUrl;
        var reader = new FileReader();  
        reader.onload = function(e) {
          var imgURL = reader.result;
          $('#notes').prepend("<div class='entry'><h1>" + Title + "</h1></p>" + "<p>" + Message + "<img src=" + imgURL + "></p> </div>");

          var notes = $('#notes').html();
          localStorage.setItem('notes', notes);
          saveDataToLocalStorage(imgURL);
        }
    reader.readAsDataURL(pic);
    return false;
});


$('#notes').html(localStorage.getItem('notes'));

$('#verwijder').click(function () {
    {
        window.localStorage.clear();
        location.reload();
    }
user3356007
  • 383
  • 1
  • 6
  • 19

0 Answers0