I am building a form using the bootstrap CSS in my Symfony project.
The problem is that when I set up a "File Input" field and when I actually load a file, the name of the file doesn't appear in this input.
So I tried to use this code :
$('.custom-file-input').on('change', function(event) {
var inputFile = event.currentTarget;
$(inputFile).parent()
.find('.custom-file-label')
.html(inputFile.files[0].name);
});
But the event "on change' is never called ( I tried to put an alert). But it seems to work here. I don't understand where is the problem ...
Finally, the solution wasn't to add
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
But it was just to move the javascript includes in the block instead of the end of the !