Skip to content

Instantly share code, notes, and snippets.

@miraglia
Created September 1, 2010 03:40
Show Gist options
  • Save miraglia/560187 to your computer and use it in GitHub Desktop.
Save miraglia/560187 to your computer and use it in GitHub Desktop.
//get an element reference, add a click handler
Y.one('#demo').on('click', function(e) {/*handle click*/});
//add content to an element
Y.one('#demo').append(" Additional content added to #demo.");
//listen for any click on any <li> that descends from #demo:
Y.one('#demo').delegate('click', function(e) {/*handle clidk*/}, 'li');
//move #demo to the location of any click on the document
Y.one('document').on('click', function(e) {
Y.one('#demo').setXY([e.pageX, e.pageY]);
}
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment