Answer edited after question changed:
One way to resolve this is to record dynamic events. Within your defined click you record the click for the dynamically named element. That may be enough or not, depending on your case.
If not, within the click you trigger an event for that element and reference that event later. Example:
var elem = '#elemento',
event1 = 'fire1',
event2 = 'fire2',
event3 = 'fire3',
count = 0;
// registra o clique pro primeiro elemento
$(elem).click(function() {
count++;
// registra o clique pros outros elementos em ordem
$('body').on('click', elem+count, function() {
// se necessário, dispara um novo evento
$(this).trigger('fire'+count);
});
console.log('trigger registrado para o elemento '+count);
});
// Usando os eventos criados
// Só disparam depois que clicar X vezes no primeiro elemento, ativando cada um
$('body').on(event1, function(e) {
console.log('clique dinamico no elemento 1');
});
$('body').on(event2, function(e) {
console.log('clique dinamico no elemento 2');
});
$('body').on(event3, function(e) {
console.log('clique dinamico no elemento 3');
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<div id="elemento">clique</div>
<div id="elemento1">el1</div>
<div id="elemento2">el2</div>
<div id="elemento3">el3</div>
The code you put here works perfectly: https://jsfiddle.net/dks20s7s/ Your real problem is not described here. Please adapt jsFiddle to show your problem.
– Sergio
Joy Peter can [Dit] the question and explain the problem better?
– Sergio
What you need is to transfer the event
click
to thediv
subsequent s to then perform some action on each of them, right?– Kenny Rafael
yes that’s right.
– Joy Peter