`The Bootstrap modal fails to display`

I have a navigation bar with a button that is supposed to open a modal when clicked. I've tried following the guidance from Bootstrap's documentation and even checked out this question: bootstrap modal not working at all

Unfortunately, nothing seems to be working so far, and there are no errors showing up in the console.

HTML

<!DOCTYPE html>
<html>
    <head lang="en">
        <meta charset="UTF-8">
        <title>Legion Analytics</title>
        <script src="https://cdn.plot.ly/plotly-latest.min.js"></script>
        <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js"></script>
        <script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.6/d3.min.js"></script>
        <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.3/umd/popper.min.js" 
        integrity="sha384-vFJXuSJphROIrBnz7yo7oB41mKfc8JzQZiCq4NCceLEaO4IHwicKwpJf9c9IpFgh" crossorigin="anonymous"></script>
        <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"
        integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
    </head>
    <body class = "bg-light">
        <nav class="navbar navbar-dark bg-dark">
            <span class="navbar-brand mb-0 h1 text-center">Legion Analytics</span>
            <div class="form-inline my-2 my-lg-0">
                    <button class="btn btn-warning my-2 my-sm-0" id='open-modal-btn' data-toggle="modal" data-target="#update-modal">Update DB</button>
            </div>
        </nav>
        <div class="modal fade" id="update-modal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
            <div class="modal-dialog" role="document">
                <div class="modal-content">
                    <div class="modal-header">
                        <h5 class="modal-title" id="exampleModalLabel">Modal title</h5>
                        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                        <span aria-hidden="true">&times;</span>
                        </button>
                    </div>
                    <div class="modal-body">
                        <form method="POST" enctype="multipart/form-data" id="turvo-upload">
                            <div class="file-upload-wrapper">
                                <label for="file">Upload new Turvo Data</label>
                                <input type="file" name="turvo-upload-file" class="form-control-file" id="excel-upload-file">
                                <button class="btn btn-outline-success" type="button" id="submit_turvo" method="POST" style="margin-top: 30px">
                                    <span class="spinner-border spinner-border-sm" role="status" aria-hidden="true" id = "db_spinner_table"></span>
                                        Submit File
                                </button>
                            </div>
                        </form>
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
                        <button type="button" class="btn btn-primary">Save changes</button>
                    </div>
                </div>
            </div>
        </div>
        <div class="container-fluid">
            {% include 'rate_analysis.html' %}
            {% include 'rate_engine.html' %}
        </div>
        <script src="{{ url_for('static', filename='js/jquery-1.11.1.min.js') }}"></script>
        <script src="{{ url_for('static', filename='js/plots.js') }}"></script>
    </body>
</html>

Answer №1

Upon reviewing your code, here are the modifications made:

  1. JQuery library is now included
  2. Bootstrap JavaScript file has been added (previously only had the CSS included)
  3. The form element wrapping the button has been changed to a <div> to prevent automatic form submission

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<head lang="en">
        <meta charset="UTF-8">
        <title>Legion Analytics</title>
         <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js"></script>
        <script src="https://cdn.plot.ly/plotly-latest.min.js"></script>
        <script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.6/d3.min.js"></script>
        <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.3/umd/popper.min.js" 
        integrity="sha384-vFJXuSJphROIrBnz7yo7oB41mKfc8JzQZiCq4NCceLEaO4IHwicKwpJf9c9IpFgh" crossorigin="anonymous"></script>
        <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"
        integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
    </head>
<body class = "bg-light">
        <nav class="navbar navbar-dark bg-dark">
            <span class="navbar-brand mb-0 h1 text-center">Legion Analytics</span>
                <div class="form-inline my-2 my-lg-0">
                    <button class="btn btn-warning my-2 my-sm-0" id='open-modal-btn' data-toggle="modal" data-target="#update-modal">Update DB</button>
                </div>
        </nav>
        <div class="container-fluid">

            <div class="modal fade" id="update-modal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
                <div class="modal-dialog" role="document">
                    <div class="modal-content">
                        <div class="modal-header">
                            <h5 class="modal-title" id="exampleModalLabel">Modal title</h5>
                            <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                            <span aria-hidden="true">&times;</span>
                            </button>
                        </div>
                        <div class="modal-body">
                            <form method="POST" enctype="multipart/form-data" id="turvo-upload">
                                <div class="file-upload-wrapper">
                                    <label for="file">Upload Excel DAT File</label>
                                    <input type="file" name="turvo-upload-file" class="form-control-file" id="excel-upload-file">
                                    <button class="btn btn-outline-success" type="button" id="submit_turvo" method="POST" style="margin-top: 30px">
                                        <span class="spinner-border spinner-border-sm" role="status" aria-hidden="true" id = "db_spinner_table"></span>
                                            Submit File
                                    </button>
                                </div>
                            </form>
                        </div>
                        <div class="modal-footer">
                            <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
                            <button type="button" class="btn btn-primary">Save changes</button>
                        </div>
                    </div>
                </div>
            </div>
</body>

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Using AJAX to query a database and updating a div tag with the submitted form entries

I need assistance in setting up a webpage with an AJAX form. The idea is that upon submission, the form's values will be used to search and query a database for results, which will then be displayed in the same DIV as the form. Any guidance or help o ...

What is the best way to search the NPM REST API in order to find the most accurate results?

I'm trying to find an effective way to query the npm REST API in order to get relevant search results. I aim to seamlessly integrate this search feature into my application. For instance, when I search for "bootstrap" on npm, I receive various result ...

Rails controller did not receive the Ajax call

I have noticed that when I make an Ajax call using jQuery, the data is always transmitted (status 200), but there are times when it's not properly received by the Rails controller. The data is sent correctly, but most of the time the controller respon ...

Caution: React does not support the `textColor` prop for a DOM element

Receiving an alert message saying: Warning: React does not recognize the 'textColor' prop on a DOM element (all other functionalities are functioning properly). This is how I'm using it in my component: import { ImageWithFallback, Paper, Ta ...

How can the order of elements appended to a documentFragment be controlled when they are returned asynchronously?

Curious question here... I am constructing my in-memory DOM and relying heavily on promises. Let's say I have this snippet inside a loop: target = document.createDocumentFragment(); promises = [], pass, skip, store; for (i = 0; i < foo; i += 1) ...

Flask WSGI environment experiences difficulty with opening Selenium

I am facing challenges while trying to execute Selenium within a Flask application running on Apache as a WSGI application inside a venv. (My suspicion is that the issue might be related to permissions, but I haven't been able to find a solution yet. ...

Display a div based on the selection of various radio buttons

I'm in the process of creating a form and would like to include additional fields when a negative response is chosen from a set of three radio buttons. Currently, the code works for a single button, but I want it to apply to any of the three buttons. ...

Creating a personalized v-for loop with v-if to apply a specific class to a div element

How can I correctly utilize v-if when using v-for inside? I am aiming to implement a condition where if the index is 0 or it's the first data, then add an active class. <div class="item active" v-for="(item, key, index) in slideItem" :key="item._ ...

Displaying tooltips with ngx-charts in Angular

Currently, I am working on developing a unique legend component that features individual material progress bars for each data entry. My goal is to display the pie chart tooltip when hovering over any of the entries within this custom legend. Below is a sn ...

Confirming the authenticity of a property within one entity by comparing it to a property within another entity

When validating two objects, sending and receiving countries, it is important to ensure that they are not identical. Specifically, we want to check if the receiving country is the same as the sending country and if it is, return an error message. The fol ...

Troubleshooting: Missing MapState in Vuex4 for Vue3 within an MVC project

Within my MVC project, I have successfully integrated Vue3 with Vuex4. However, I have encountered an issue specifically related to the mapState function. Upon using the following import statements, an error is triggered: import Vue from 'vue'; ...

Animate the expansion and shrinkage of a div instantly using jQuery

I am trying to create an animation effect using jQuery animate on a div element where it starts large and then becomes smaller. Here is the code I have written: $(this).animate({ opacity: 0, top: "-=100", width: "38px", height: "32px" }, 1 ...

Looking for assistance with designing a responsive login box

Greetings! I'm a beginner in programming, so please excuse me if my issue seems simple. I have a website with a login form, but I am struggling to make it responsive. Every time I attempt to do so, the entire layout gets messed up. Could someone kin ...

Issue with date and time range in SQL query when using PHP AJAX

I've been struggling with a major issue for the past 4 days, and I'm really hoping to find a solution here. After countless unsuccessful attempts, I've turned to this platform for help. The problem at hand involves using a SQL Server databa ...

Explore three stylish ways to showcase dynamic JavaScript content using CSS

Objective: For Value 1, the CSS class should be badge-primary For Value 2, the CSS class should be badge-secondary For all other values, use the CSS class badge-danger This functionality is implemented in the handleChange function. Issue: Current ...

Manipulating Pixel Width and Height of Cells in Google Sheet using Apps Script

I'm looking for a solution to effectively retrieve and update the height and width in pixels of a Google Cell using Google Apps Script. While there is a built-in getWidth() function available, it only returns the width of the range in cells, which doe ...

Maintain the organization of folders during compilation using grunt

Currently, I am using grunt to convert jade files into HTML files. The structure of my files is as follows: index.jade |--partials/ view1.jade view2.jade To compile these files, I am utilizing grunt-contrib-jade. Below is the code ...

How can you implement a switchable theme feature similar to Twitter on your website?

As a beginner programmer and college student with limited design knowledge, I am working on creating a microblogging website similar to Twitter. I noticed that some websites use pre-loaded styles or themes without separate CSS files. I am unsure of how t ...

Focus on a specific data set within a JSON file when working with Backbone.js

Hello! I am new to learning Backbone.js and would love some suggestions from the experts out there. Here is a snippet of my code: app.Collections.UserCollection = Backbone.Collection.extend({ model: app.Models.IdModel, url: "/test/test_data.json" ...

What's the best way to apply a class to a React element upon clicking it?

I'm currently working on a React component to create a hamburger menu, but I'm struggling to add a class when a button is clicked. I'm fairly new to React, so any gentle guidance would be appreciated. The code below is what I have so far, bu ...