Morugar_

JS random text output

Apr 6th, 2022 (edited)
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     $(document).ready(function () {
  2.         $("#add").click(function () {
  3.             let item = $("#title").val()
  4.             $("#todo").append(`<li>${item}</li>`)
  5.             $("#title").val("");
  6.         })
  7.  
  8.         $("html").on("click", "li", function () {
  9.             var random = Math.floor(Math.random() * 3)
  10.             var random_text
  11.             if (random === 0) {
  12.                 random_text = "Kek"
  13.             }
  14.             else if (random === 1) {
  15.                 random_text = "Omg"
  16.             }
  17.             else {
  18.                 random_text = "true"
  19.             }
  20.  
  21.             if(window.confirm("Вы точно хотите удалить этот пункт?" + " " + random_text)) {
  22.        $(this).fadeOut(1000)
  23.             setTimeout(() => $(this).remove(), 1000)
  24.       }
  25.         })
  26.     })
Add Comment
Please, Sign In to add comment