Dear, greetings to all! Maybe it's a bit basic, but I'd rather be sure and ask.
I have a div
in which I have ordered several input
, some of them label
, in which I refer to a input file
, in this way;
<table class="title">
<tr>
<td style="width: 20%" >
<input class="" value="1" type="checkbox" name="tipo_cert[]" id="tipo_cert_1" />
<label for="tipo_cert_1">Para subir archivo</label>
</td>
</tr>
</table>
<br/><br/>
<div id="arch1" style="display: none;">
<div id='file1' class="file">
<input type="hidden" class="txtFile1" name="txtFile1" value="" />
<label class="text" id='text1' for="6_1_adjn">Seleccione un archivo</label>
<label for="6_1_adjn" >
<input id="6_1_adjn" name="6_1_adjn" class='fileInput required' type="file" value="" />
</label>
</div>
</div>
By means of a checkbox
, I make appear and disappear a div
that contains this code. Then when you click on this checkbox
and disappear this, you should clean all the input of this div
. And that's where I'm stuck. I clean the hidden
, I can unmark the checkbox
but I can not clean the label
and if I put a .val('')
to input file
it says: 'security issue', therefore with input file
I'm not going to put =) haha
My JS code;
$('#tipo_cert_1').on('change', function () {
if ($('#tipo_cert_1').is(':checked') == true) {
$("#arch1").attr('style', 'display: block;');
}else{
$("#arch1").attr('style', 'display: none;');
$("#arch1 input[type=checkbox]").prop("checked", false);
// $("#arch1 input[type=label]").text("");
// $("#arch1 input:label").text("");
}
});
Now, does it affect that this label
is within a div
that is within another div
? A question that perhaps is the reason why I can not clean or reach this label
.
Dear, this is my concern. Once a teacher told me that the only question is the ONE that is NOT asked.