jquery 按钮引导3.3.7不工作显示/隐藏

nimxete2  于 2022-12-03  发布在  jQuery
关注(0)|答案(2)|浏览(130)

按钮出现问题。我可以打开内容,但再次单击时,没有任何更改,而它应该关闭...

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <link rel="stylesheet" type="text/css" href="css/bootstrap.css">
    <link rel="stylesheet" type="text/css" href="css/style.css">
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
    <title>Bio-chemia</title>
</head>

.....

<div id="Biophura" class="container text-center">
  <button type="button" class="btn btn-success btn-lg" data-toggle="collapse" data-target="#demo89">BIOPHURA</button>
  <div id="demo89" class="collapse">
    Lorem ipsum dolor sit amet, consectetur adipisicing elit,
    sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
    quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
  </div>
uyto3xhc

uyto3xhc1#

您错过了结束标记div

<div id="Biophura" class="container text-center">
  <button type="button" class="btn btn-success btn-lg" data-toggle="collapse" data-target="#demo89">BIOPHURA</button>
  <div id="demo89" class="collapse">
    Lorem ipsum dolor sit amet, consectetur adipisicing elit,
    sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
    quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
  </div> 
</div>
qnakjoqk

qnakjoqk2#

<!DOCTYPE html>
<html>
<head>
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>
<body>
<div id="Biophura" class="container text-center">
<div class="container">
  <button type="button" class="btn btn-info" data-toggle="collapse" data-target="#demo89">BIOPHURA</button>
  <div id="demo89" class="collapse">
    Lorem ipsum dolor sit amet, consectetur adipisicing elit,
    sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
    quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
  </div>
</div>
</div>

那就是100%有效

问题出在脚本链接中

相关问题