Several modal windows on a single webpage

On this page I have implemented Bootstrap collapse and modal functionality. The issue I am facing is that when the user clicks on the "Anfrage" button (The yellow button), the modal pops up and works correctly. However, once the modal is closed, the interaction with the page becomes disabled. How can I resolve this problem? Below is the code snippet:

<div class="col-lg-12 table1">
            <div id="printableArea">
        <img class="logo_print logo1" src="img/logo.png" alt="" height="90" width="130" />
                      <p class="stampa stampa_ipad">Gewerbe Bölli<br>Böllistrasse 18<br>CH - 5072 Oeschgen<br>Tel 062 866 16 88<br>Fax 062 866 16 99<br><a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="98f1f6fef7d8e2b5f9ffb6fbf0">[email protected]</a></p>
       <button class="btn" data-parent="tableParent" data-toggle="collapse" data-target="#table1" class="table1" style="margin-bottom: 20px; width: 100% !important; background: #fadf3e; color:#000;">Mietdampfanlage 21 kg/h 10 bar</button>
        <div id="table1" class="collapse">
        <table class="table table-striped table-bordered table-hover" width="744">
                    <thead>
                    <tr>

                    <th style="text-align: center;">Kriterium</th>
                    <th style="text-align: center;">Einheit</th>
                    <th style="text-align: center;">Grösse</th>
                    </tr>
                    </thead>
                    <tbody>
                <!--Table content here-->
                    
    <button id="modal_1" type="button" class="btn btn-primary special" style="background: #fadf3e; border: 2px solid #000; color: #000; margin-bottom: 20px; margin-top: -10px; width: 100%;" data-toggle="modal" data-target=".bs-example-modal-sm" data-keyboard="true" data-backdrop="static" >Anfrage</button>
    <div class="modal fade bs-example-modal-sm" tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel">
      <div class="modal-dialog modal-sm">
        <div class="modal-content">
            <div class="row">
             <div class="col-sm-12 form">
                 <div class="modal-header">
                 <h4 style="color: #000;">Mietdampfanlage 21 kg/h 10 bar</h4>
                 </div>     
                        <form class="form-modal" role="form" method="post" action="index.php">
                <!--Form fields here-->
            
                
                    </div>
                    </div>      
                    </div>

Answer №1

Your errors are minor and easily fixable.

You mistakenly assigned the same class name (bs-example-modal-sm) to both modals and then tried to call them using the same name on the button, causing the issue you are experiencing.

To resolve this, it is recommended to use IDs instead of classes for calling. For example - id="modal-1" and modal-2.

Additionally, make sure to replace the names on the button itself:

<button id="modal_2" type="button" class="btn btn-primary special" style="background: #fadf3e; border: 2px solid #000; color: #000; margin-bottom: 20px; margin-top: -10px; width: 100%;" data-toggle="modal" data-target="#modal-1">Request</button>

Notice the change in 'data-target'. I have replaced the ID with the class name you originally used.

In addition to these changes, you can also add a close button in the modal header to allow users to easily close the modal:

<div class="modal-header">
    <button class="close" data-dismiss="modal" aria-hidden="true" id="close" align="right">x</button>
    <h4 class="modal-title" id="myModalLabel">Rental Steam Boiler 21 kg/h 10 bar</h4>
</div>

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

What is the best way to align navigation arrows vertically?

I am working on a modal album that displays images of various sizes. My issue is with styling the navigation arrows to appear in the center of the page, regardless of the image size. I have included my code below: <div class="row img-box"> <d ...

Formatting won't assist in aligning Facebook button

I am currently working on a page that includes a div with a Facebook recommend button. In order to style the Facebook code, I enclosed it with this formatting: <div style="align:center"> <div id="fb-root"></div> <script src=" ...

The Bootstrap slide function encounters issues within the AJAX success callback

Here's the code snippet with a 'slide' event inside an AJAX success call. success: function(data) { $('#my_container').html(data); // Successfully loading #mycarousel into #my_container $('#mycarousel').bind( ...

What is the best way to align content in the center when its parent element has a position property

JSBIN Is it possible to center the number row without using JavaScript to calculate its position, considering its parent has a fixed attribute? I've tried using CSS properties like margin and text-align with no success. Any suggestions on achieving t ...

SSL page on Wordpress struggles to load CSS files

My current website is on WordPress: The issue I am facing is on this particular page: , where the CSS is not loading correctly. This specific page uses SSL connection, and when checking through Firebug, I noticed that no CSS files are being sent. What co ...

What are your thoughts on combining a JSON object with HTML?

When using ASP.NET MVC, it is possible to return a JSONResult. return JSON(new { View = RenderViewAsString("MyView", model), wasSuccessful = true}) This approach combines HTML and data in a single JSON object. The goal is to utilize strongly typed HtmlHe ...

Modify HTML style content

Here's an excerpt from my CSS file: .pricing .pricing-value .price:before { position: absolute; content: 'different text'; top: 10px; left: -35px; } I'm wondering if it's possible to change 'different text' to s ...

The HTML page is not responsive to the screen size of the mobile device

Check out my HTML code: <!DOCTYPE HTML> <html lang="en-US"> <head> <meta charset="UTF-8> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Test</title> <style type= ...

Pulling Specific HTML Element from External Website with PHP

<?php $info = file_get_contents('http://examplewebsite.com/data'); echo $info; ?> I am trying to extract specific information from a remote website using PHP, focusing only on certain tags. While I have found a script that allows me t ...

What could be causing my code to not align vertically in the Grid layout?

As I delve into developing with React and MaterialUI, a perplexing issue has arisen where elements refuse to align vertically. My expertise lies mostly in backend development, leaving me with minimal knowledge of frontend development nuances, especially co ...

Updating HTML label values using jQuery in a loop based on their index position

I am having an issue with my ajax call where I want to loop through each label in a class and set their value to the response returned from the server. However, the current code sets all labels to the same value instead of setting individual values based o ...

Tips on ensuring CSS is properly loaded on a Django HTML page

Despite numerous attempts, I cannot get my CSS to render properly on any of the HTML pages within a Django project. I've tried various solutions from Stack Overflow, such as adding the following code snippet: <link rel="stylesheet" href=& ...

`How can I extract JSON data from the text values entered in an HTML table?`

Extracting values from a JSON object using JavaScript and displaying them in header and input $('#convert-table').click( function() { var iptable=$("#example-table").find('input').serializeArray(); var table = $('#example- ...

Optimal approach for blending release and debug code in a web application

Currently, I am in the process of developing a simple browser-based game for two players. While my main focus lies on the backend, I need to monitor the states of both players simultaneously. To achieve this without the hassle of working with two separate ...

Animate elements in Vue.js when navigating between pages is a great way to enhance user

I'm looking to add animation to a specific element once the route page finishes loading. This is not related to route page transitions. I've experimented with various methods, trying to animate a progress bar based on dynamic data values. I attem ...

Fade out when the anchor is clicked and fade in the href link

Is it possible to create fade transitions between two HTML documents? I have multiple HTML pages, but for the sake of example, let's use index.html and jobs.html. index.html, jobs.html Both pages have a menu with anchor buttons. What I am aiming to ...

Is it possible to refresh a div on one .aspx page using content from another .aspx page?

Just beginning my journey with asp.net and currently tackling a project that involves two .aspx pages. Events.aspx: This page is where the site admin can update upcoming events and webinars using an available panel to input event title, date, information ...

Exploring the latest MUI Styles in Scoping Version 5

We are currently in the process of transitioning our legacy application to React and MUI. To ensure that there is no styling conflict between the old and new parts of the application, we have implemented scoped styles by combining an id selector with a des ...

Steps to correct alignment in a numbered list when the dot is removed using CSS

Currently, I'm working on developing a rule page for a game. The specific layout requirements dictate that the rules be presented in an ordered list without periods following each number: 1 Rule one 2 Rule two 3 Rule three To achieve this format ...

Tips for arranging letters on separate lines using CSS

I have a set of four divs that display numbers, and I want to show the corresponding words below each number. Despite trying to use the p tag with white-space: pre; in CSS, I have not been successful: #c { padding-top: 30px; padding-bottom: 30px; } ...