Skip to main content

How to remove Choose File button in jquery

You can remove the choose file button in jquery using the remove method. JQuery remove() method removes the selected elements and it’s child element.

  • Remove choose file button on click button

    <!DOCTYPE html>
    <html lang="en">
        <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <meta http-equiv="X-UA-Compatible" content="ie=edge">
        <title>Title</title>
        <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
        </head>
        <body>
        
        <input type="file" name="image" id="file" />
        <button id="removeFile"> Remove file </button>
        <script>
            $('#removeFile').on('click', function(){
                $('#file').remove();
            })
            </script>
        </body>
    </html>
    
  • Back to code snippet queries related jquery