Bootstrap snippet and html example. Show Hide Columns using bootstrap table

This html snippet was created to help web designers, web developers, front-end and back-end developer save time. Use it for free in your project and build your app faster, You can also download the HTML, CSS, and JS code.

HTML code

This is the html code used to create this bootstrap snippet, You can copy and paste the following html code inside a page with bootstrap 3.3.6 included, to get the result that you can see in the preview selection

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous" />

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js" integrity="sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS" crossorigin="anonymous"></script>
<div class="container">
    <div class="row">
        <div class="col-md-12">
<div class="table-responsive">
            <table class="table table-bordered">
                <thead>
                    <tr>
                        <th>#</th>
                        <th id="click-me">Click Me</th>
                        <th>Last Name</th>
                        <th>Username</th>
                        <th class="toggleDisplay">Th 1</th>
                        <th class="toggleDisplay">Th 2</th>
                        <th class="toggleDisplay">Th 3</th>
                        <th class="toggleDisplay">Th 4</th>
                    </tr>
                </thead>
                <tbody>
                    <tr>
                        <th scope="row">1</th>
                        <td>Mark</td>
                        <td>Otto</td>
                        <td>@mdo</td>
                        <td class="toggleDisplay">Td 1</td>
                        <td class="toggleDisplay">Td 2</td>
                        <td class="toggleDisplay">Td 3</td>
                        <td class="toggleDisplay">Td 4</td>
                    </tr>
                    <tr>
                        <th scope="row">2</th>
                        <td>Jacob</td>
                        <td>Thornton</td>
                        <td>@fat</td>
                        <td class="toggleDisplay">Td 1</td>
                        <td class="toggleDisplay">Td 2</td>
                        <td class="toggleDisplay">Td 3</td>
                        <td class="toggleDisplay">Td 4</td>
                    </tr>
                    <tr>
                        <th scope="row">3</th>
                        <td>Larry</td>
                        <td>the Bird</td>
                        <td>@twitter</td>
                        <td class="toggleDisplay">Td 1</td>
                        <td class="toggleDisplay">Td 2</td>
                        <td class="toggleDisplay">Td 3</td>
                        <td class="toggleDisplay">Td 4</td>
                    </tr>
                </tbody>
            </table>
        </div>
    </div>
</div>
</div>

CSS code

This is the css code used to create this bootstrap snippet, You can copy and paste the following css code inside a page with bootstrap 3.3.6 included, to get the result that you can see in the preview selection

body{margin-top:20px;}

.toggleDisplay {
  display: none;
}
.toggleDisplay.in {
  display: table-cell;
}

Javascript/Jquery code

This is the javascript code used to create this bootstrap snippet, You can copy and paste the following javascript code inside a page with bootstrap 3.3.6 included, to get the result that you can see in the preview selection

$("#click-me").click(function() {
    $(".table .toggleDisplay").toggleClass("in");
}); 

Similar snippets

Bootstrap example and template. blog list page

blog list page

Bootstrap example and template. product traking list

product traking list

Bootstrap example and template. Forum post list

Forum post list

Bootstrap example and template. Complete User Profile Page for Bootstrap

Complete User Profile Page for Bootstrap

Bootstrap example and template. bs5 dark footer

bs5 dark footer

Bootstrap example and template. new customer list

new customer list

Bootstrap example and template. timeline steps

timeline steps

Bootstrap example and template. profile edit data and skills

profile edit data and skills

Bootstrap example and template. Show Hide Columns using bootstrap table

About this bootstrap example/template

We hope you will enjoy this awesome snippet and stay tuned for the latest updates, bootdey snippets are already used in thousands of blogs, websites and projects. We believe it will save your precious time and gives trendy look to your next web project.

We always try to offer the best beautiful and responsive source of Bootstrap code examples and components.

This code example currectly have 16.3K views, Using this bootstrap snippet you have the following benefits:

Bootstrap 3.3.6

<link rel='stylesheet' href='https://netdna.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css'>

<script src='https://netdna.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js'></script>

This code example is based on bootstrap 3.3.6 and the grid system of this framework

Responsive

Based on bootstrap framework makes all the layouts perfectly responsive for all devices

Crossbrowser compatibility

Tested on all major browsers, it works smoothly on all of them

Jquery plugins

Great built-in plugins with jquery framework, you can easy to change all declarations

semantic html 5

Built on html / css3 the code quality is really amazing

Simple Integration

This code example can be simply integrated on existing sites and new ones too, all you need to do is copy the code and start working