How to remove dropify file upload element using jquery

Viewed 1957

This is form code.

<form action="#" class="form-horizontal" id="exam-form">
 <div class="col-lg-12 col-md-12">
    <div class="card">
        <div class="card-body">
            <h4 class="card-title">Exam Image (Max 500x500)</h4>
            <label for="input-file-max-fs">You can add a max file size</label>
            <input type="file" id="input-file-max-fs" class="dropify" data-max-file-size="2M" name="image"  />
        </div>
    </div>
</div>
</form>

I want to remove dropify file upload, i tried multiplle way but it not working.

$("#exam-form").remove(".dropify");
$("#exam-form input[name=image]").remove();
2 Answers

Not remove it instead just hide it via jquery.

    <form action="#" class="form-horizontal" id="exam-form">
     <div class="col-lg-12 col-md-12">
        <div class="card">
            <div class="card-body">
                <h4 class="card-title">Exam Image (Max 500x500)</h4>
                <label for="input-file-max-fs">You can add a max file size</label>
                <input type="file" id="input-file-max-fs" class="dropify" data-max-file- 
                size="2M" name="image"  />
            </div>
        </div>
    </div>
</form>

JQUERY:

$(".dropify").css("display","none");

Just do it in above of document.

You nearly had it, correct should be (look the quotes):

$('#exam-form input[name="image"]').remove();
Related