Advertisement
dimon-torchila

Untitled

Mar 16th, 2022
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 1.54 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4.     <meta charset="UTF-8">
  5.     <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script>
  6.     <script>
  7.         $(document).ready(function (){
  8.             $('.add_news').click(function (){
  9.                 let block_card = $(this).parents('.card')[0];
  10.                 console.log(block_card);
  11.                 //block_card.prepend("<div class = 'new_bl'>Новость добавлена</div>");
  12.                 let a = $('<div>',{
  13.                     class: 'new_bl',
  14.                     text: 'Новость добавлена',
  15.                 });
  16.                 a.prependTo(block_card);
  17.             })
  18.         });
  19.     </script>
  20.     <style>
  21.  
  22.         .card{
  23.             width: 250px;
  24.             text-align: center;
  25.             background-color: aqua;
  26.             margin-top: 10px;
  27.         }
  28.         .block_title{
  29.             height: 80px;
  30.             background-color: blue;
  31.         }
  32.         .block_but{
  33.             height: 80px;
  34.             background-color: blue;
  35.         }
  36.     </style>
  37.     <div class = 'card'>
  38.         <div class = 'block_title'> Первая нововсть </div>
  39.         <div class = 'block_descr'>
  40.             ...<br>
  41.             ...<br>
  42.             ...<br>
  43.         </div>
  44.         <div class = 'block_but'>
  45.             <input type="button" value = "Добавить" class = 'add_news'>
  46.             <input type="button" value="Отклонить" class="reject_news">
  47.         </div>
  48.     </div>
  49. </head>
  50. <body>
  51.  
  52. </body>
  53. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement