0

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.

2 Answers 2

4

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

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

Sign up to request clarification or add additional context in comments.

1 Comment

Okay, I give up on life. Checked the code many times, read through everything. ITS ALWAYS THE SIMPLE THINGS. Not sure how I missed that. But thanks, saved me pulling MORE hair out.
1

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');
      });

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.