Guest User

Untitled

a guest
Feb 20th, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. let sto = [localStorage.getItem("sticker")];
  2.  
  3. pushResult();
  4.  
  5. $("#textInput").change(function() {
  6. if ($(this).val() !== "") {
  7. sto.push($(this).val())
  8. localStorage.setItem("sticker",sto);
  9.  
  10. pushResult();
  11. }
  12. });
  13.  
  14. function pushResult() {
  15. $('#result').html('')
  16. $.each(sto, function(key, value) {
  17. $('#result').append(`<li key="${key}">${value}</li>`);
  18. document.getElementById("textInput").value = "";
  19. });
  20. };
Add Comment
Please, Sign In to add comment