Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

225
Views
data-bs-dismiss after twice click then closes modal

i have funny problem in bootstrap 5.0.2

I have to double-click the button (data-bs-dismiss) to close the modal

Important note:‌I use many modal in page, But they open depending on the need

<div class="modal" id="open-rating-modal-for-order" tabindex="-1" aria-labelledby="open-call-modal" aria-hidden="true">
  <div class="modal-dialog">
    <div class="modal-content">
      <form method='POST' onsubmit="return validate_rating_modal()">
        <input type='hidden' name='page' value='submit-rate' />
        <input type='hidden' name='csrf_token' value="{$csrf_token}" />
        <div class="modal-header">
          <h5 class="modal-title" id="exampleModalLabel">
            rates
          </h5>
          <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
        </div>
    </div>
  </div>
</div>

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

I just applied the fade class style to the first container and added a <button> element to trigger the modal to pop up and it worked successfully.

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
    <title>Document</title>
</head>

<body>
    <div class="d-grid gap-2">
        <button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#open-rating-modal-for-order">
        Open Modal
        </button>
    </div>

    <div class="modal fade" id="open-rating-modal-for-order" tabindex="-1" aria-labelledby="open-call-modal"
        aria-hidden="true">
        <div class="modal-dialog">
            <div class="modal-content">
                <form method='POST' onsubmit="return validate_rating_modal()">
                    <input type='hidden' name='page' value='submit-rate' />
                    <input type='hidden' name='csrf_token' value="{$csrf_token}" />
                    <div class="modal-header">
                        <h5 class="modal-title" id="exampleModalLabel">
                            Rates
                        </h5>

                        <button type="button" class="btn-close" data-bs-dismiss="modal"></button>
                    </div>
                </form>
            </div>
        </div>
    </div>

    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM" crossorigin="anonymous">
    </script>
</body>
</html>

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!