Crevice

Untitled

Nov 6th, 2019
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.68 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  6. <meta http-equiv="X-UA-Compatible" content="ie=edge">
  7. <title>Document</title>
  8. <style>
  9. .click-div {
  10. height: 150px;
  11. width: 550px;
  12. display: inline-block;
  13. background-color: aquamarine;
  14. text-align: center;
  15. }
  16. p {
  17. font-size: 3rem;
  18. width: 75%;
  19. margin: 0 auto;
  20. border: 1px solid black;
  21. }
  22. .click-div, p {
  23. position: absolute;
  24. top: 50%;
  25. left: 50%;
  26. transform: translate(-50%,-50%);
  27. border-radius: 10px;
  28.  
  29. }
  30. </style>
  31.  
  32. </head>
  33. <body>
  34.  
  35. <div class="click-div" id="click-div">
  36. <p>I am the Click Div</p>
  37. </div>
  38.  
  39.  
  40.  
  41. <script>
  42. //within these script tags:
  43. // declare an variable called clickDiv
  44. // assign the selector for the element with the id of "clickDiv" to the clickDiv variable
  45. // using "core JS", not jQuery, attach a click event listener to the clickDiv selector
  46. // have the click event call a function "handleClick" with a single parameter "event", which
  47. // will console log the event object which is passed
  48. // in by the event handler when it calls the "handleClick" function(Look In the Documentation!)
  49. // have the same function call an alert saying you were successful
  50. // for a bonus challenge, add more elements and event listeners using "core JS"
  51. </script>
  52.  
  53. </body>
  54. </html>
Add Comment
Please, Sign In to add comment