关闭按钮不显示Bootstrap警报

时间:2016-11-13 23:13:24

标签: twitter-bootstrap

我有以下使用bootstrap的html。它大部分都有效 - 但关闭按钮不会出现在警报中。我在这里缺少什么代码?请注意,我是Bootstrap的新手 - 所以,它可能很简单。

小提琴http://jsfiddle.net/LijoCheeran/vxbt960c/

代码

<!DOCTYPE html>
<html>
  <head>
    <title>Bootstrap 101 Template</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <!-- Latest compiled and minified CSS -->
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
  </head>

<body>

    <h1>Hello, world!</h1>

<div class="alert alert-success">
  <strong>Success!</strong> Bootstrap applied to alert.
</div>


<div style = "padding: 10px 10px 10px;">
   <form class = "bs-example bs-example-form" role = "form">
      <div class = "input-group">
         <span class = "input-group-addon">$</span>
         <input type = "text" class = "form-control" placeholder = "Amount">
         <span class = "input-group-addon">.00</span>
      </div>
   </form>
</div>

<!-- jQuery library -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>

<!-- Latest compiled JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>

</body>

</html>

2 个答案:

答案 0 :(得分:4)

您的代码中缺少此行。

<?php
include 'database-include.php';

$connection = mysqli_connect(DBHOST, DBUSER, DBPASS, DBNAME);

$error = mysqli_connect_error();
if($error != null){
    $output = '<p>Unable to connect to database<p>'.$error;
    exit($output);    
}

echo '<ol>
    <li>Add a customer</li>
    <li>Add an order</li>
    <li>Remove an order</li>
    <li>Ship an order</li>
    <li>Print pending orders with customer information</li>
    <li>Re-stock parts</li>
    <li>Exit</li>
</ol>
<form action="Northwind_Database_Shahbaaz_Singh.php" method="get">
    <input type="text" value="'.$_GET['choice'].'" name="choice">';
if(isset($_GET['choice'])){
    $choice = $_GET['choice'];
    echo '<br/>';    

    if($choice == 1){
        echo '<input type="text" placeholder="Customer Name" name="customer_name">
        <button>Submit</button>';
        if(isset($_GET['customer_name'])){
            echo 'Success';
        }
    } else if ($choice == 2){
        echo "2";
    } else if($choice == 3){
        echo "3";
    } else if($choice == 4){
        echo "4";  
    } else if($choice == 5){
        echo "5";
    } else if($choice == 6){
        echo "5";
    } else if($choice == 7){
        exit("Goodbye!");
    }
}
echo '</form>'; 
?>

例如:

   <a href="#" class="close" data-dismiss="alert" aria-label="close">&times;</a>

祝你好运

答案 1 :(得分:1)

您需要自己提供关闭按钮。与在the examples中一样,使用类似:

的内容
<div class="alert alert-warning alert-dismissible" role="alert">
  <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
  <strong>Warning!</strong> Better check yourself, you're not looking too good.
</div>