Input Upload Doc Toggle

by TheOrdinaryGeek

HTML

<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.6/css/bootstrap.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.6/js/bootstrap.js"></script>
<input type='text' id="attachment" name='attachment' class='form-control' value="someValueHere.jpg" disabled>
<p>
<button id="" type="button" name="removeBtn" class="btn deleteBtn btn-danger">Remove</button>

JavaScript

$(".deleteBtn").click(function() {
    var attachInput = document.getElementById("attachment");
    var attachBtnDel = document.getElementsByName("removeBtn");
    
    $( attachInput ).val("");
    $( attachInput ).prop("disabled", false); 
    $( attachInput ).attr('type', 'file');
    $( attachBtnDel ).removeClass( "btn-danger" ).addClass( "btn-default" );
    $( attachBtnDel ).prop("disabled", true);
    

});