Lovelock
Lovelock

Reputation: 8085

jQuery problems with Bootstrap

need to learn the basics of bootstrap for a new project coming up but so far its hurting my brain.

For some reason, I cannot get basic jQuery to function on the website.

Heres a jsFiddle of the basic bootstrap:

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

Here is the pay structure:

<!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>

The playerlist will not change the html, The .html() is just to test. Nothing I try is working...

A you can see in the example it doesnt work, have tested it in a blank fiddle and ofcourse it works fine.

Cannot see why this is failing, its so simple.

Craig.

Upvotes: 0

Views: 514

Answers (2)

Claudiu Creanga
Claudiu Creanga

Reputation: 8366

You are calling playerlist when you should playerList. JavaScript is case sensitive:

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

Upvotes: 4

hamidfzm
hamidfzm

Reputation: 4685

jQuery is working well just what you have to do is pass correct id to jQuery. Change

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

to

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

Upvotes: 1

Related Questions