I need one help. I could not make file field blank after passing event using Jquery/Javascript. I am explaining my code below.
<div class="form-group filefield">
<label for="exampleInputFile">Attachment : </label>
<input type="file" class="filestyle form-control" data-size="lg" name="attachment" id="attachment" style="padding:0px; height:0px;" value="<?php echo $getpromo->attachment; ?>" onchange="changeAttachmentStatus(0)">
</div>
<select class="form-control" id="coupontypepromo" name="coupontypepromo" onchange="changeAttachmentStatus(1)">
<option value="" selected>Select coupon</option>
<?php
$copon=$db->kf_coupon->find(); $num=$db->kf_coupon->count();
if($num >0){
foreach($copon as $v){
?>
<option value="<?php echo $v['_id']; ?>" <?php
if ($getcustomerobj->coupon_id == $v['_id']) { print 'selected'; }
?>><?php echo $v['cfile']; ?></option>
<?php } }?>
</select>
My javascript code is given below.
function changeAttachmentStatus(value){
if(value==0){
$('#coupontypepromo').val("");
$('#coupontypepromo').attr('disabled', 'disabled');
}
if(value==1){
$("#attachment").val("");
$('#attachment').attr('disabled', 'disabled');
}
}
Here i need while user will select the file the select option will disable and if user is choosing the select value the file should blank and field should disable.Here the file value could not blank. Please help me to resolve this issue.