container css code example

Example 1: container in bootstrap

Containers
Containers are the most basic layout element in Bootstrap and are required when using our default grid system. Choose from a responsive, fixed-width container (meaning its max-width changes at each breakpoint) or fluid-width (meaning it’s 100% wide all the time).
While containers can be nested, most layouts do not require a nested container.

Syntax:

Example 2: container js

$(document).ready(function() {
  $('#submit').click(function() {
    var list = ['Car', 'Bike', 'Scooter'];
    for (var value of list) {
      $('#container')
        .append(``)
        .append(`
`) .append(`
`); } }) });

Example 3: js container class

function Branches() {

    function Branch() {
        var _id;

        _id = Math.round(Math.random()*10);

        this.getId = function() {
            return _id;
        }

    }

    this.createBranch = function() {
        var branch = new Branch;
        _branches.push(branch);
    }

    this.getBranches = function() {
        return _branches;
    }

    this.getBranchIds = function() {
        var branch_list = this.getBranches();

        var branch_ids = [];

        for (var i = 0; i < branch_list.length; i++) {
            var branch_id = branch_list[i].getId();
            branch_ids.push(branch_id);
        }

        return branch_ids;
    }

    var _branches = [];

}

// code test
var test = new Branches;

for (var i = 0; i < 7; i++) {
    test.createBranch();
}

console.log("Branch IDs:\n" + test.getBranchIds());

Tags:

Misc Example