NikloYa
NikloYa

Reputation: 49

Why is my bootstrap not working?

Please help me! Why is bootstrap not loading the classes?

Here's my code which is just a table and a simple button, yet no classes are applied

<!DOCTYPE html>
<html>
<head>
    <title>
        <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.4/jquery.js"></script>
        <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
        <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
        <script src="https://cdn.datatables.net/1.10.16/js/jquery.dataTables.min.js"></script>
    </title>
</head>
<body>

<table class="table" id="table">
    <thead>
        <tr>
            <th>Order ID</th>
            <th>TX ID CxPay</th>
            <th>TX ID IY</th>
            <th>Amount</th>
            <th>Class</th>
            <th>Date</th>
        </tr>
    </thead>
    <tbody>

        <tr>
            <td>1asas</td>
            <td>1asas</td>
            <td>1asas</td>
            <td>1asas</td>
            <td>1asas</td>
            <td>1asas</td>
        </tr>
    </tbody>
</table>
<button class="btn btn-success">asasa</button>
<script>
    $(document).ready(function() {
    $('#table').DataTable();
} );
</script>
</body>
</html>

Neither bootstrap nor datatables is working. What am I missing here? Any help is appreciated!

Upvotes: 0

Views: 4068

Answers (2)

Lucas David Ferrero
Lucas David Ferrero

Reputation: 1912

You are importing the script inside <title> that's not correct. In <title> only text is allowed describing your page's title. Place your <script> and <link> above the </head>

Upvotes: 4

GGO
GGO

Reputation: 2748

All your included files are in your <title>. You have to write :

<head>
    <title>My Title</title>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.4/jquery.js"></script>
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
    <script src="https://cdn.datatables.net/1.10.16/js/jquery.dataTables.min.js"></script>
</head>

Upvotes: 2

Related Questions