Advertisement
AlexTasev

Notes

Nov 15th, 2018
354
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function addSticker() {
  2.     let title = $('.title');
  3.     let text = $('.content');
  4.     let ul = $('#sticker-list');
  5.  
  6.     if (title.val() && text.val()) {
  7.         let li = $('<li class="note-content">');
  8.         let a = $('<a class="button">x</a>');
  9.         a.on('click', () => li.remove());
  10.         let h2 = $(`<h2>${title.val()}</h2>`);
  11.         let hr = $('<hr>');
  12.         let p = $(`<p>${text.val()}</p>`);
  13.  
  14.         $(li)
  15.             .append(a)
  16.             .append(h2)
  17.             .append(hr)
  18.             .append(p)
  19.             .appendTo(ul);
  20.  
  21.         title.val("");
  22.         text.val("");
  23.     }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement