Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
When you cut down a head of Hydra, another two heads appear. A button is a head.
<!DOCTYPE html>
<title>Hydra - Delete one button & produce two more!</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<body id="hydrabody">
<button class="hydrahead">Hydra Head</button>
<script src=""></script>
YUI().use('node', 'event',function (Y) {
var hydra = function(e){;
var twoheads = Y.Node.create('<button class="hydrahead">Hydra Head</button><button class="hydrahead">Hydra Head</button>');'#hydrabody').insert(twoheads);
};'#hydrabody').delegate('click', hydra, 'button');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment