jQuery与Bootstrap的问题

jQuery problems with Bootstrap

本文关键字:问题 Bootstrap jQuery      更新时间:2023-09-26

需要为即将到来的新项目学习引导程序的基础知识,但到目前为止,它伤害了我的大脑。

由于某些原因,我无法在网站上使用基本的jQuery。

以下是基本引导程序的jsFiddle:

http://jsfiddle.net/D2RLR/6891/

以下是薪酬结构:

<!DOCTYPE html>
<?php 
  // require the database connection / action class
  require('libs/PHP_Classes/class.database.php');
  require('libs/PHP_Classes/class.table.php');
?>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">
    <link rel="icon" href="../../favicon.ico">
    <title>PHPGamble</title>
    <!-- Bootstrap core CSS -->
    <link href="css/bootstrap.css" rel="stylesheet">
    <!-- Custom styles for this template -->
    <link href="sticky-footer-navbar.css" rel="stylesheet">
    <!-- Just for debugging purposes. Don't actually copy these 2 lines! -->
    <!--[if lt IE 9]><script src="../../assets/js/ie8-responsive-file-warning.js"></script><![endif]-->
    <script src="js/ie-emulation-modes-warning.js"></script>
    <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!--[if lt IE 9]>
      <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
      <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <![endif]-->
  </head>
  <body>
    <!-- Begin page content -->
    <div class="container">
      <div class="panel panel-default">
        <div class="panel-heading">
          <h3 class="panel-title">Current Players On Table</h3>
        </div>
        <div class="panel-body" id="playerList">
          Player 1 Player 2
        </div>
      </div>
    </div>
    <div class="footer">
      <div class="container">
        <p class="text-muted">Copyright Craig Lovelock 2014</p>
      </div>
    </div>
    <!-- Bootstrap core JavaScript
    ================================================== -->
    <!-- Placed at the end of the document so the pages load faster -->
    <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
    <script src="js/bootstrap.min.js"></script>
    <!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
    <script src="js/ie10-viewport-bug-workaround.js"></script>
    <script>
      $(document).ready(function(){
        $('#playerlist').html('ss');
      });
    </script>
  </body>
</html>

playerlist不会更改html,.html()只是为了测试。我所尝试的一切都无效。。。

你可以在这个例子中看到它不起作用,在空白的小提琴中测试过它,当然它也很好。

看不出为什么会失败,这太简单了。

克雷格。

您正在调用playerlist,而您应该调用playerList。JavaScript区分大小写:

http://jsfiddle.net/D2RLR/6892/

jQuery运行良好,只需要将正确的id传递给jQuery即可。更改

$(document).ready(function(){
        $('#playerlist').html('ss');
      });

$(document).ready(function(){
        $('#playerList').html('ss');
      });