.show() and .hide not working for bootstrap modal

<button class="button primary" id="buy" style="text-decoration:none;" type="button">Review and confirm</button>

<div class="modal-bootstrap fade bs-example-modal-sm" id="myModal" tabindex="-1" role="dialog" aria-labelledby="smallModalLabel" aria-hidden="true">
    <!-- modal contents -->
</div>

<script type="text/javascript">
$("#buy").click(function () {
    var a = 4;
    if (a == 5) {
        alert("if");
        $('#myModal').modal('show');
    } else {
        alert("else");
        $('#myModal').modal('hide');
    }
});
</script>

Are there any code examples left?
Create a Free Account
Unlock the power of data and AI by diving into Python, ChatGPT, SQL, Power BI, and beyond.
Sign up
Develop soft skills on BrainApps
Complete the IQ Test
Relative searches
bootstrap modal hide and show again bootstrap modal is not hiding after opening bootstrap modal not hiding modal show not working bootstrap 4 bootstrap modal not showing content modal bootstrap not showing modal hide after show not working bootstrap modal opens but not visible bootstrap modal content not showing bootstrap 4 modal not showing bootstrap modal not visible bootstrap 4 modal is not visible .modal('hide'); not working bootstrap modal content is not visible bootstrap modal is not visible modal on hidden function not working .modal('hide') not working bootstrap 5 modal show not working modal not showing bootstrap bootstrap modal show not working bootstrap modal on show not working bootstrap modal show but is not working .modal('hide') not working but .modal('show') is modal bootstrap doesn't show bootstrap modal is not showing modal hide doesn't work why my bootstrap modal is not hiding modal hide not working after:2018 bootstrap 4 modal not hiding bootstrap 4 modal not hide modal.hide() not working $('.modal').modal('hide') doesnt work bootstrap modal not showing my bootstrap modal content not showing modal not showing bootstrap 4 modal not showing after hide bootstrap modal not hidden by default bootstrap modal not hidden modal hide event not working modal not working bootstrap .on(&quot;hidden.bs.modal&quot; not working bootstrap modal hide is not working modal show not working after hide dismiss model not working jquery modal not loading after another modal hide Modal not loading after another modal hides $('#examplemodal').modal('hide') .modal('hide') not working bootstrap 4 hide modal jquery without hide bootstraps modals hide on save modal.hide not working jquery boostrap modal box not to hide toggle hide after modal popup modal hide not working javascript jquery bootstrap modal hide not working bs4 modal hide event not working hidden class to the error modal in the HTML modal hide not working angular modal('hide') not working $('#job').modal('hide'); model not define $('.alert').modal('hide'); bootstrap 4 modal hide not working modal not hide jquery on hide modal don't work how to hide a modal then trigger alert jquery modal hide not working .modal('hide') not working hide modal not working jquery modal on hide didn't work jquery modal on hide didnt work modal hide not working how to if run action modal not hide if run action modal not hide jquery can't hide modal .modal( hide ) not working inside ready function bootstrap modal hide not working $('.modal').modal('hide') not a function do not hide modal jquery using hide to close the modal but getting error jquery hide current modal not all jquery modal hidden detection not working jquery modal hidden detexting not working jquery modal hidden not working .show() and .hide not working for bootstrap modal
Made with love
This website uses cookies to make IQCode work for you. By using this site, you agree to our cookie policy

Welcome Back!

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign in
Recover lost password
Or log in with

Create a Free Account

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign up
Or sign up with
By signing up, you agree to the Terms and Conditions and Privacy Policy. You also agree to receive product-related marketing emails from IQCode, which you can unsubscribe from at any time.
Creating a new code example
Code snippet title
Source