Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script>
- <script>
- $(document).ready(function (){
- $('.add_news').click(function (){
- let block_card = $(this).parents('.card')[0];
- console.log(block_card);
- //block_card.prepend("<div class = 'new_bl'>Новость добавлена</div>");
- let a = $('<div>',{
- class: 'new_bl',
- text: 'Новость добавлена',
- });
- a.prependTo(block_card);
- })
- });
- </script>
- <style>
- .card{
- width: 250px;
- text-align: center;
- background-color: aqua;
- margin-top: 10px;
- }
- .block_title{
- height: 80px;
- background-color: blue;
- }
- .block_but{
- height: 80px;
- background-color: blue;
- }
- </style>
- <div class = 'card'>
- <div class = 'block_title'> Первая нововсть </div>
- <div class = 'block_descr'>
- ...<br>
- ...<br>
- ...<br>
- </div>
- <div class = 'block_but'>
- <input type="button" value = "Добавить" class = 'add_news'>
- <input type="button" value="Отклонить" class="reject_news">
- </div>
- </div>
- </head>
- <body>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement