Answers for "container js"

1

container js

$(document).ready(function() {
  $('#submit').click(function() {
    var list = ['Car', 'Bike', 'Scooter'];
    for (var value of list) {
      $('#container')
        .append(`<input type="checkbox" id="${value}" name="interest" value="${value}">`)
        .append(`<label for="${value}">${value}</label></div>`)
        .append(`<br>`);
    }
  })
});
Posted by: Guest on May-27-2020
1

div container style

<div class="tab-content col-md-12" 
style="	width:600px;
        box-shadow: 3px 3px 3px 3px grey;
        margin:10px;
        background-color: #E0D8D6;
      ">
Posted by: Guest on November-12-2020
0

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());
Posted by: Guest on October-22-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language