JSFiddle - React, Tailwind, and code Playground
JavaScript
(function() {
var counter = 1;
$('.selector').live("click", function() {
// Note that the self executing functions are only
// necessary if you want to use arguments.
counter++ % 2 ?
(function() {
$("div").html("First one! Num: " + ($(event.target).index() + 1))
}(event)) :
(function() {
$("div").html("Numero dos! Num: " + ($(event.target).index() + 1))
}(event));
});
$(function() {
$elie = $('<input type="button" class="selector" value=" Click Me! " />');
$elie.clone().prependTo("body");
$elie.clone().prependTo("body");
$elie.clone().prependTo("body");
});
}());