This application does not work as expected.
var storeElements = []; var store = [];
$('body').on('click', 'a.add_aluno', function () {
var aside = $(this).parent().parent().children('aside');
$(this).parent().parent().append('<aside id="inner_form">' + aside.html() + '</aside>');
aside.each(function () {
storeElements.unshift($(this));
});
for (var i = 4; i < storeElements.length; i += 4) {
store.push(storeElements[i]);
}
if (store.length >= 4) {
//Aqui preciso inserir quebra de linha a partir do 4º aside gerado, e o proximo é 8 depois 12, etc..
}
});
So he inserts the asides when he arrives in the 4th he inserts the line break only that in 6 7 he inserts again, in that case I need to insert in the 4 after 8 then 12, etc ...
html
<form id="boletin_cad" action="env_boletin.php" method="POST">
<aside id="inner_form">
<select name="aluno">
<option value="">Selecione o aluno</option>
<?php
$pega_alunos = $db->prepare("SELECT * FROM efcol_cadastro WHERE status_conta = ? ORDER BY nome");
$pega_alunos->execute(array('Ativo'));
while ($dados_alunos = $pega_alunos->fetch()) {
echo '<option value="' . $dados_alunos['id'] . '">' . $dados_alunos['nome'] . '</option>';
}
?>
</select><br />
<select name="materia">
<option value="">Selecione a Matéria</option>
<option value="01">LIBERTAÇÃO I</option>
<option value="02">REGIÕES DE CATIVEIRO</option>
<option value="03">H. ESPIRITUAL</option>
<option value="04">ESQ. JEZABEL</option>
<option value="05">ABORTO</option>
<option value="06">ADULTÉRIO</option>
<option value="07">DIVÓRCIO</option>
<option value="08">LIB. SEXUAL I</option>
<option value="09">LIB. SEXUAL II</option>
<option value="10">INIMIGOS ESPIRITUAIS</option>
</select><br />
<legend>
<span>Ano Letivo</span>
<input type="text" name="ano" />
</legend>
<legend>
<span>Semestre</span>
<select name="semestre">
<option value="1">1º</option>
<option value="2">2º</option>
</select></legend><br /><br />
<legend>
<span>Média</span>
<input type="text" name="notas" />
</legend>
<legend>
<span>Faltas</span>
<input type="text" name="faltas" />
</legend>
</aside>
<div class="botoes">
<button name="add_media">Cadastrar</button>
<a href="javascript:void(0);" class="add_aluno">+ ADD ALUNO +</a>
</div>
</form>