I think that would be what you need, I made the example below see if it meets you.
Summary of the code:
The inputs that you want to appear after clicking include, added the css class: scoped like this: hidden class="".
I created the class in css: *Note if you use Bootstrap you can replace the hidden class with Hidden which has the same function.
.hidden{
display:None;
}
I added the method to the button with the click event (Can be used in other system calls ai vai from you )
Used Jquery, the method removes all classes:Hidden from all inputs that have it, Causing inputs to appear
I hope he answers you.
$("input[type='submit']").click(function() {
$(".escondido").removeClass("escondido");
});
.escondido{
display: none;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<div id="produto">
<input type="text" name="produto"> <input type="text" name="quantidade"> <input type="text" name="valor"> <input type="text" name="subtotal"> <input type="submit" value"Incluir">
<!-- Campos que ficarao escondidos -->
<input type="text" class="escondido" name="codigo_produto"> <input type="text" class="escondido" name="ean"> <input class="escondido" type="text" name="un_medida"> <input type="text" class="escondido" name="descricao"> <input type="text" class="escondido" name="tributos">
</div>
You can’t use it
id="produto[]"
?– Guilherme Lautert
Define a class of type inputHidden with display: None, add this class to these inputs, create an inputShow with display: block, when Voce wants to show the input Voce just adds inpitShow with js for all elements with inputHidden
– MarioAleo
"appear 5 more inputs", what’s the problem with jQuery append? Or you just want to display some hidden entries?
– BrTkCa