Django, code inside <script> tag doesn't work in a template


I'm trying to use Bootstrap File Input in my django application. I've loaded all necessary files in header. Here is my form:

<form enctype="multipart/form-data">
<div>
 <input id="file1" name="file1[]" class ="file" type="file" multiple="multiple">
<div>
</form>

Bootstrap File Input works fine. But I need to configure some options. In tutorial and examples its looks like that:

<script>
$('#file1').fileinput({
  showUpload: false,
});   
</script>

Code inside the script tag doesn't work. Any script in this tag doesn't work. Tried to use $(document).ready(function(){}) in the beggining, but without result. What can be wrong with it? Script goes after form.

Answer

May be you can try this :

<input id="file1" name="file1[]" type="file" multiple class="file-loading">
<script>
$(document).on('ready', function() {
    $("#file1").fileinput({
        showUpload: false,
    });
});
</script>
source: stackoverflow.com
js interview questions