Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <meta http-equiv="X-UA-Compatible" content="ie=edge">
- <title>Document</title>
- <style>
- .click-div {
- height: 150px;
- width: 550px;
- display: inline-block;
- background-color: aquamarine;
- text-align: center;
- }
- p {
- font-size: 3rem;
- width: 75%;
- margin: 0 auto;
- border: 1px solid black;
- }
- .click-div, p {
- position: absolute;
- top: 50%;
- left: 50%;
- transform: translate(-50%,-50%);
- border-radius: 10px;
- }
- </style>
- </head>
- <body>
- <div class="click-div" id="click-div">
- <p>I am the Click Div</p>
- </div>
- <script>
- //within these script tags:
- // declare an variable called clickDiv
- // assign the selector for the element with the id of "clickDiv" to the clickDiv variable
- // using "core JS", not jQuery, attach a click event listener to the clickDiv selector
- // have the click event call a function "handleClick" with a single parameter "event", which
- // will console log the event object which is passed
- // in by the event handler when it calls the "handleClick" function(Look In the Documentation!)
- // have the same function call an alert saying you were successful
- // for a bonus challenge, add more elements and event listeners using "core JS"
- </script>
- </body>
- </html>
Add Comment
Please, Sign In to add comment