Created
February 19, 2015 11:49
-
-
Save JoanClaret/a9bea5b92a576dfe083a to your computer and use it in GitHub Desktop.
Simple Javascript encapsulation
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
var linkcolor = (function(selector, $){ | |
$(selector).click(function(e){ | |
// console.log($(this)); // display target element | |
// console.log(e); // display event information | |
// console.log(e.clientX); // display event property value | |
// console.log(e.target); // display event property value | |
if ($(this).hasClass('active')){ | |
alert($(this).attr('id')); | |
} | |
}); | |
}); | |
linkcolor(".js-link", $); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment