What I want to do is generate ID dynamically through jquery, and it generates it within a for the only problem I have with that is that it always leaves me the last ID that reads and I want each ID to be different.
Code where the ID is generated:
<script>
$(document).ready(function(){
var PHP_VARS = <?php echo $planta; ?>;
for (var i=0; i<PHP_VARS; i++) {
$(".accordion").append("<li class=tabs><div class=paragraph><h1>Accordion</h1><p>Esto es una Pruba.</p></div></li>")
$('.tabs').attr('id', 'tabs'+i);
}
$(".accordion").click(function() {
$(".tabs").css("width","300px");
});
});
</script>
HTML code:
<body id="cuerpo">
<div class="container">
<ul class="accordion">
</ul>
</div>
</body>