Facebook
From Jittery Meerkat, 1 Year ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 109
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4.     <meta charset="UTF-8">
  5.     <meta http-equiv="X-UA-Compatible" content="IE=edge">
  6.     <meta name="viewport" content="width=device-width, initial-scale=1.0">
  7.     <title>Block below</title>
  8.  
  9.     <style>
  10.         .block{
  11.             padding: 20px 40px;
  12.             width: fit-content;
  13.             margin-bottom: 10px;
  14.             border: solid 1px black;
  15.         }
  16.         .red{
  17.             background-color: red;
  18.         }
  19.         .blue{
  20.             background-color: blue;
  21.         }
  22.         .green{
  23.             background-color: green;
  24.         }
  25.     </style>
  26. </head>
  27. <body>
  28.     <div class="block red"></div>
  29.     <div class="block green"></div>
  30.     <div class="block blue"></div>
  31. </body>
  32. <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.3/jquery.min.js"></script>
  33. <script>
  34.  
  35.     $(".block").click(function() {
  36.         for(let i=0;i<3;i++){
  37.             $(this).after("<div class='block'></div>")
  38.         }
  39.     })
  40.  
  41. </script>
  42. </html>