Advertisement
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>
- <!--add the script tag and CDN for jquery here-->
- <script>
- $(document).ready(initializeApp)
- function initializeApp () {
- //add a click handler here for the div with an id of clickDiv
- //it should call a named function "handleClick" which takes "event" as a parameter
- //the function should log out the event object
- //(Note the difference between the jquery event object and the event object from
- //the previous challenge)
- //the "handleClick" function should also call an alert which congratulates you on success
- // for a bonus challenge, use jQuery to "toggle" the class of "chartreuse" when the div is clicked
- }
- </script>
- <style>
- .click-div {
- height: 150px;
- width: 550px;
- display: inline-block;
- background-color: lightgray;
- 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;
- }
- .chartreuse {
- background-color: chartreuse
- }
- </style>
- </head>
- <body>
- <div class="click-div" id="clickDiv">
- <p>I am the Click Div</p>
- </div>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement