2
Well I want to access the text content inside the div and show in an Alert(), but for this I have a list of users selected from the database, I made a small trick to add a counter in each class of the div that contains the user name, see the example:
and so on. Only when I put Alert(), it displays all users at once within Alert, even though I create a div for each one. Someone and give a hand. my Code:
$('.innerbox_contatos_search').click(function(){ $('.info-part a').addClass('ativo'); var i = 1; $(".ativo").each( function() { $(this).attr("class", "ativo-"+i); alert($('a.ativo-'+i).text()); i++; }); });
You can add your HTML as well?
– Sergio
What exactly do you want to show on Alert?
– André Ribeiro
I want it to show only the class with the increment of each div, for example when I click on David appear: David and the class of "David" will be: <div class="active-1"></div> When I click on josé (which in the case is the second user)appear: Joseph and Joseph’s class will be: <div class="active-2"></div>
– David Damasceno