You just need to, at the event change()
of your <input type=file>
check the value of it, if it is different from empty, show the add another button, which would be hidden until then(guess) and add an event of click()
to him to add another <input type=file>
to your document, which would be:
function verificaMostraBotao(){
$('input[type=file]').each(function(index){
if ($('input[type=file]').eq(index).val() != ""){
$('.hide').show();
}
});
}
$('input[type=file]').on("change", function(){
verificaMostraBotao();
});
$('.hide').on("click", function(){
$(document.body).append($('<input />', {type: "file" }).change(verificaMostraBotao));
$('.hide').hide();
});
And HTML would be this:
<input type=file>
<input type=button class=hide value="Adicionar outro">
With proper css to hide button:
.hide {
display: none;
}
That’s right, Paul, just like that. If the guy clicked to add on the first one he wanted the add-plus button to disappear and appear only when the next tbm input is loaded. It is possible?
– Jefferson Alison
ready @Jeffersonalison
– Paulo Roberto Rosa
That boy, hehe... once again Thank you!
– Jefferson Alison
I’m here for this :) Arrange
– Paulo Roberto Rosa