Ir para conteúdo

POWERED BY:

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

zipzap

input file e jquery

Recommended Posts

$('#btn').click(function(){
    $.each($('input'), function(i, item)) {
        if (item.type == 'file') {
            alert(item.value);
        }
    });
});

<input type="file" />
<input type="text" />
<input type="text" />
<input type="text" />
<input type="checkbox" />
<input type="button" id="btn" value="check" />

Jquery também tem o selector :file se quiser todos os inputs to tipo file na pagina.

O mesmo código acima ficaria assim...

 

$('#btn').click(function(){
    $.each($('input:file'), function(i, item)) {
        alert(item.value);
    });
});

Compartilhar este post


Link para o post
Compartilhar em outros sites

×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.