1
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’s inserting the asides when he arrives in the 4th he inserts the line break only in the 6 7 he inserts again, in which case I need him to enter in the 4 after 8 after 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>
I don’t know if I understand but the idea is to show a drawn result or really every four indices of a list depending on how the answer may be different
– Lauro Moraes
ola the idea is every 4 indices even only one at each click.
– José Roberto Juliana
javascript already know how scroll could add asides (html). so you can understand that you are adding to the array of elements (A) the very item that calls the event click (referencing this) and again adding the "A" when you push the variable store at this point this empty realize
– Lauro Moraes
already inserted html blz in this case I need to generate 3 asides in 4 breaks the line, generates 5, 6, 7 in 8 break line...
– José Roberto Juliana