In this example, a plain JavaScript code and a specific jQuery function are separately used to hide an element using Bootstrap 3.

By Rnel, on May 23, 2015, under Bootstrap Tutorials

In Bootstrap 3, adding a class "hidden" to an element will hide it. To do this dynamically, you can use a plain JavaScript, or jQuery to append the said class to the element you want to hide, as demonstrated on this BootStrap Tutorial.

Plain JavaScript
Get the element by it's id, and append the "hidden" class.

var elem = document.getElementById("elem");
elem.className = elem.className + " hidden";

Use the .addClass() function to insert the class "hidden".


Live Demo

Learn how to show a bootstrap hidden element by reading the other BootStrap Tutorial How to show an element with a Bootstrap "hidden" class using jQuery