Reputation: 355
I need to save my appended html() text, every time i click the button it should be store in HTML 5 local storage.
$('#add_new_criteria').on('click',function(){
$('#cyc_append').html(': Add new another criteria');
localStorage.setItem( ???? );
});
Upvotes: 1
Views: 442
Reputation: 53
localStorage.setItem('key','value');
you can check result in Chrome Console -> Resources -> Local Storage whether it is getting saved.
Refer following link https://developer.mozilla.org/en/docs/Web/API/Window/localStorage
Upvotes: 0
Reputation: 5622
$('#add_new_criteria').on('click',function(){
$('#cyc_append').html(': Add new another criteria');
localStorage.setItem('textKey', $('#cyc_append').html());
});
The first argument is the identifier you’ll later use to get the data out again. The second is the data you want to store.
Read more on localStorage
Upvotes: 2