Advertisement
Peaser

jQuery "Close button"

May 23rd, 2015
532
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 0.81 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3.   <head>
  4.     <script type="text/javascript" src="http://code.jquery.com/jquery-2.1.4.min.js"></script>
  5.     <script type="text/javascript">$(document).ready(function(){$(".closable").append("<span class='closebtn'>X</span>"),$(".closebtn").click(function(){$(this).parent().remove()})});</script>
  6.     <style type="text/css">
  7.     .closable {
  8.       position: relative;
  9.     }
  10.     .closebtn {
  11.       cursor: pointer;
  12.       display: inline-block;
  13.       position: absolute;
  14.       top: 0px;
  15.       right: 0px;
  16.       margin: 0px;
  17.       padding: 4px;
  18.       color: rgba(0,0,0,0.25);
  19.       width: 25px;
  20.       height: 25px;
  21.       font-size: 16px;
  22.     }
  23.     .closebtn:hover {
  24.       color: rgba(0,0,0,0.5);
  25.     }
  26.     </style>
  27.   </head>
  28.   <body>
  29.     <!-- Insert content here -->
  30.   </body>
  31. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement