javascript - No action clicking on Bootstrap popup -
i need implement pop window on clicking 1 link. html code snippet:
<head> <script type="text/javascript" src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <script type="text/javascript" src="/stylesheets/script.js"></script> <script src="http://code.jquery.com/jquery-1.11.0.min.js"></script> <script src="http://code.jquery.com/jquery-migrate-1.2.1.min.js"></script> <script src= "http://ajax.googleapis.com/ajax/libs/angularjs/1.2.26/angular.min.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <link rel='stylesheet' href='/stylesheets/bootstrap-theme.css' /> <link rel='stylesheet' href='/stylesheets/bootstrap-theme.min.css' /> <link rel='stylesheet' href='/stylesheets/bootstrap.css' /> <link rel='stylesheet' href='/stylesheets/bootstrap.min.css' /> </head> <body style="overflow-x:hidden"> <!--header--> <div id = "header"> <div class="navbar navbar-inverse navbar-fixed-top"> <div class="container"> <div class="navbar-header"> <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse"> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> <a class="navbar-brand" href="/kanbannew">welcome</a> </div> <div class="navbar-collapse collapse"> <ul class="nav navbar-nav navbar-right"> <li><a href="#" data-toggle="modal" data-target="#mymodal" data-whatever="add card">add card</a></li> <li><a href="kanbanprojectstatus">project status</a></li> <li><a href="index">logout</a></li> </ul> </div><!--/.nav-collapse --> </div> </div>
<div id="mymodal" class="modal fade"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> <h4 class="modal-title">modal title</h4> </div> <div class="modal-body"> <p>one fine body…</p> </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><!-- /.modal-content --> </div><!-- /.modal-dialog --> </div><!-- /.modal --> <script> $('#mymodal').on('show.bs.modal', function (event) { var li = $(event.relatedtarget) // button triggered modal var recipient = li.data('whatever') // extract info data-* attributes var modal = $(this) modal.find('.modal-title').text(recipient) }) </script> </body>
clicking on 'add card' button of header, want show pop user can input title , description , submit same. sample modal not opening. advice? thanks.
your data-target="#mymodal"
referring <div>
should have id='mymodal'
hence change line
<div class="modal fade">
to
<div id="mymodal" class="modal fade">
and should work.
note: missing bootstrap.css file.
update:
you should load jquery
first. remove scripts
, links
, load in manner:
<link rel='stylesheet' href='/stylesheets/bootstrap.min.css' /> <link rel='stylesheet' href='/stylesheets/bootstrap-theme.css' /> <link rel='stylesheet' href='/stylesheets/bootstrap-theme.min.css' /> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"> </script> <script src= "http://ajax.googleapis.com/ajax/libs/angularjs/1.2.26/angular.min.js"></script> <script type="text/javascript" src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"> </script> <script type="text/javascript" src="/stylesheets/script.js"></script>
Comments
Post a Comment