Answers for "add checkbox dynamically in javascript"

1

add checkbox dynamically in javascript

$(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

Code answers related to "add checkbox dynamically in javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language