diff --git a/boxes.html b/boxes.html index 44586a8..e19d5ec 100644 --- a/boxes.html +++ b/boxes.html @@ -1,38 +1,43 @@ -
- - - -
');
+// Exercise 3
+// 1.
+$('#container').click(function(event) {
+ console.log("X: " + event.pageX + " Y: " + event.pageY);
+});
+
+// 2.
+$('div.box.boxType1').append('Galvanize').click(function(event) {
+ alert("You can never leave the page.");
+ event.preventDefault();
+});
+
+// 3.
+$('.box').click(function(event) {
+ $('.box').append('
');
+});
+$('.box').click(function(event) {
+ $('.box').empty();
+});
+
+//4.
+$("#container").click(function(event) {
+ if ($(event.target).is($(this))) {
+ $(this).css("background-color", "limegreen");
+ } else {
+ $(event.target).css("background-color", "white");
+ $(this).css("background-color", "black");
+ }
+});