mercredi 1 juillet 2015

How do I get a value in jQuery to PERMANENTLY be added to the html file?

Simply, there is a function on my website which allows users to enter text and have it display on a page.

HOWEVER, that text does not stay permanently and disappears when the page is reloaded.

How do I get jQuery to add the text inserted in the textarea to stay on that page once submitted?

This is what my jQuery looks like.

    //When the 'button' is clicked, it prints whatever is in the textarea in separate divs

//this is it:

$(document).ready(function() {
$('#button').click(function() {
    var toAdd = $('textarea[name=input]').val();
    $('.list').append('<div class="posts">' + toAdd + '</div>');
});
});

Please ask me if you don't understand me and thank you in advance for any help :)

Aucun commentaire:

Enregistrer un commentaire