Johann-S / bs-custom-file-input

A little plugin for Bootstrap 4 custom file input
https://bs-custom-file-input.netlify.com/
MIT License
210 stars 39 forks source link

Not able to make this work - no filename. Script and #92

Open MacelinCane opened 3 years ago

MacelinCane commented 3 years ago

I've installed via NPM into my Laravel 8 project. I've added all this at the bottom of my page

<script>
    bsCustomFileInput.init();

    var btn = document.getElementById('btnResetForm');
    var form = document.querySelector('form');
    btn.addEventListener('click', function () {
        form.reset()
    })
</script>

I've added this to my form `

                            </div>`

When I click Browse, I am able to choose a file, but nothing else. No filename shows. I see "use with npm - import bsCustomFileInput from 'bs-custom-file-input'" but I'm not sure what this means if I've already installed it via npm.

I have a 404 for the js file and an uncaught ref error bsCustomFileInput is not defined.

What am I missing? Thanks

MacelinCane commented 3 years ago

Addendum. I tried it with all the exact code on the sample page here and got the same errors. I'm sure the problem is me, but I'm at the end of things I know to try. Npm puts that file into node_modules but that can't be referenced once rendered so I'm not sure how to reference it in the src script, and it doesn't exist in any public resources.