Last active
January 18, 2018 16:26
-
-
Save rayinla/6ab097457b115b97fb7bbde42c28bb2f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(document).ready(function(){ | |
//It is important to notice that 'button' is a DOM object with various methods | |
$('button').on('click', function(){ | |
//We must preserve the button's context | |
bluezy(); | |
function bluezy(){ | |
//We're saying, "I want to do fun things with <<that>> button object, | |
//not <<this>> window object you keep giving me | |
$(this).css("background-color", "blue"); | |
}.bind(this) | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Are u shure there're no mistakes?
'That' does not defiend and 'this' > .