javascript - Bootstrap 的 jQuery 问题

标签 javascript jquery twitter-bootstrap

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

出于某种原因,我无法让基本的 jQuery 在网站上运行。

这是基本 Bootstrap 的 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>

玩家列表不会改变html,.html()只是为了测试。我尝试的任何方法都不起作用...

您可以在示例中看到它不起作用,在空白 fiddle 中对其进行了测试,当然它工作得很好。

不明白为什么会失败,它是如此简单。

克雷格。

最佳答案

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

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

关于javascript - Bootstrap 的 jQuery 问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25959232/

相关文章:

html - Bootstrap css 与我的代码不兼容

css - Bootstrap : how to Make the website always operate as "lg"

javascript - 根据js中的搜索结果计算百分比

javascript - 我应该保守我的地理编码 api key 的 secret 吗?

javascript - 尝试在 Jest 中模拟命名的 commonjs 模块

javascript - 通过指针调用带参数的 JavaScript 函数?

jquery - 我这样做正确吗? .each() & .click() jquery

jquery-ui - jQuery UI Accordion 关闭后不会重新打开

javascript - JQuery - 扩展和访问父类(super class)

javascript - 如何在 Bootstrap Accordion 中选择值