Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
41
rated 0 times [  42] [ 1]  / answers: 1 / hits: 45840  / 11 Years ago, wed, december 18, 2013, 12:00:00

I'm trying to create a simple modal popup using Bootstrap. I got the sample from http://getbootstrap.com/javascript/#modals, my code looks like this..



<html>
<head>
<script src=js/jquery.js></script>
<script src=js/bootstrap.js></script>
<script src=js/bootstrap-modal.js></script>
<link rel=stylesheet href=css/bootstrap.css />
</head>
<body>
<button class=btn btn-primary btn-lg data-toggle=modal data-target=#myModal>
Launch demo modal
</button>

<div class=modal fade id=myModal tabindex=-1 role=dialog aria-labelledby=myModalLabel aria-hidden=true>
<div class=modal-dialog>
<div class=modal-content>
<div class=modal-header>
<button type=button class=close data-dismiss=modal aria-hidden=true>&times;</button>
<h4 class=modal-title id=myModalLabel>Modal title</h4>
</div>
<div class=modal-body>
...
</div>
<div class=modal-footer>
<button type=button class=btn btn-default data-dismiss=modal>Close</button>
<button type=button class=btn btn-primary>Save changes</button>
</div>
</div>
</div>
</div>
</body>
</html>


when i run in on my browser and click the button, the popup shows only in miliseconds and then closing again..how to prevent the popup from closing like that?


More From » jquery

 Answers
37

Try this



<script src=js/bootstrap.js></script> // This JS have all necessary files


Remove below JS from your file



<script src=js/bootstrap-modal.js></script>


DEMO


[#73683] Monday, December 16, 2013, 11 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
bradleymoisesy

Total Points: 121
Total Questions: 105
Total Answers: 95

Location: Nepal
Member since Mon, Jan 4, 2021
3 Years ago
bradleymoisesy questions
Wed, Dec 22, 21, 00:00, 2 Years ago
Tue, Jun 1, 21, 00:00, 3 Years ago
Thu, Jun 11, 20, 00:00, 4 Years ago
Thu, Jan 16, 20, 00:00, 4 Years ago
;