Skip to content

Instantly share code, notes, and snippets.

@rosylilly
Created September 13, 2012 06:28
Show Gist options
  • Save rosylilly/3712349 to your computer and use it in GitHub Desktop.
Save rosylilly/3712349 to your computer and use it in GitHub Desktop.
jQuery-tapp
jQuery.fn.extend({
/**
* $('li').tapp() で console.debug に this を出力します。
*
* func を与えることで、func(this) を実行した結果を console.debug に出力します。
*
* @this {jQuery}
* @param {function(jQuery)=} func
* @return {jQuery}
*/
tapp: function(func) {
var _this = this.clone();
console.debug(func ? func.call(_this, _this) : this);
return this;
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment