1
You could help me with a problem I’m having?
Good people need to create a select with values from 1 to N numbers, after the user select a number in the select have to create n Divs from the selected value.
Follow the example not working ...
$("#qtdLote").on("change",function(){
var num=parseInt($(this).val());
for(var i=1;i<=num;i++){ // se não houver valor o loop não roda.
$("#area").append("<div> Div "+i+"</div>");
// Append adiciona ao final do elemento desejado.
}
});
div{
border:1px solid #000;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<label>Escolha</label>
<select id="qtdLote">
<option>1</option>
<option>2</option>
<option>3</option>
</select>
<div id="#area" ></div>
You can also see in the codepen: https://codepen.io/anon/pen/JZYdjv
Opa Henrique, Thank you very much for the help but this almost right, example if he chose 2 appears 2, then in the case if he choose 3 appears 3 and if he choose 1 appears only one, it shows and hides from the given value, can help me ?
– Luciano Ramos
I think I understand, I edited my code there for you to see how it would look, there are 2 options there that can be useful to you
– Henrique Pauli
Caraaamba Henrique was that Even !!! Muuuito Thank you very much.
– Luciano Ramos