Is there a way to style a label
of a certain form only when the input
of type file
is with a selected file?
Is there a way to style a label
of a certain form only when the input
of type file
is with a selected file?
I do not know if you can do this with css, you need to track the change
event in the input, anyway here is a solution using javascript:
function change_label() { // aqui coloca todas as mudanças a acontecer nos elementos que quiser
var label_file = document.getElementById("label-file");
label_file.className = "file_on";
label_file.children[0].innerHTML = 'JÁ EXISTE FICHEIRO';
}
.file_on {
color:red;
}
<label id="label-file" for="file-inp"><span>NÃO EXISTE FICHEIRO</span><br>
<input onchange="change_label();" id="file-inp" type="file">
</label>