Skip to content

Instantly share code, notes, and snippets.

@yamamoto-febc
Created June 12, 2012 14:19
Show Gist options
  • Save yamamoto-febc/2917826 to your computer and use it in GitHub Desktop.
Save yamamoto-febc/2917826 to your computer and use it in GitHub Desktop.
javascript docment3
$.Controller("MyWidget",
{
defaults : {
targetElement : 'div'
}
},
{
"{targetElement} click" : function(elm, ev){
console.log(elm);
}
}) ;
var controller1 = new MyWidget($(".selector")); //divエレメントにclickイベントがバインドされる
var controller2 = new MyWidget($(".selector") , {targetClassName : 'li' } );//liエレメントにバインドされる
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment