Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <title></title>
- <script type="text/javascript" src="https://ajax.aspnetcdn.com/ajax/jQuery/jquery-3.4.1.min.js"></script>
- <style type="text/css">
- #cir{
- width: 150px;
- height: 150px;
- border-radius: 50%;
- background-color: green;
- }
- .squ{
- width: 150px;
- height: 150px;
- margin: 10px;
- background-color: red;
- }
- </style>
- </head>
- <body>
- <div id="cir"></div>
- <div class ="squ"></div>
- <div class="squ"></div>
- <script type="text/javascript">
- $("div").click(function() {
- if($(this).attr("id") == "cir"){
- alert("you clicked on a circle");
- }
- else{
- alert("you clicked on a square")
- }
- }
- );
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement