Skip to content
Update JQuery authored by Joel H's avatar Joel H
...@@ -61,12 +61,12 @@ $('.solid').addClass('highlight'); //add the class highlight to every object wit ...@@ -61,12 +61,12 @@ $('.solid').addClass('highlight'); //add the class highlight to every object wit
```javascript ```javascript
//Events //Events
$(.box').on('click', function(){ //equivalent of AddEventListener() $('.box').on('click', function(){ //equivalent of AddEventListener()
console.log("Hello"); console.log("Hello");
$(this); //refers to the .box $(this); //refers to the .box
}); });
$(.box').on('click', '.box-button', function(){ //equivalent of AddEventListener() $('.box').on('click', '.box-button', function(){ //equivalent of AddEventListener()
console.log("Hello"); console.log("Hello");
$(this); //with 3 parameters, the 2nd parameter delegate the $(this) to the new said element $(this); //with 3 parameters, the 2nd parameter delegate the $(this) to the new said element
}); });
... ...
......