Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

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>`);
    }
  })
});
Comment

PREVIOUS NEXT
Code Example
Javascript :: vue mapgetters with parameter 
Javascript :: how to submit form on changed url in function in jquery 
Javascript :: javascript loop x times 
Javascript :: node js on macbook m1 
Javascript :: swap in javascript 
Javascript :: ngrok live port vue js 
Javascript :: date.parse string to javascript 
Javascript :: react usereducer 
Javascript :: how to convert number to character in javascript 
Javascript :: how to make fake binary 
Javascript :: how to insert html into javascript 
Javascript :: nodejs fs create file if not exists 
Javascript :: how to code print in javascript 
Javascript :: jshint ignore 
Javascript :: how to repeat an array of objects n times in javascript 
Javascript :: useeffect react example 
Javascript :: netmask /24 
Javascript :: how to clear node modules folder from your computer 
Javascript :: Select all elements with the same tag 
Javascript :: delete message discord.js 
Javascript :: npm run start vs npm start 
Javascript :: get match number array javascript 
Javascript :: map array method create object 
Javascript :: string.contains javascript 
Javascript :: javascript get black or white text base on color 
Javascript :: how to loop through something in node.js 
Javascript :: merge-sort js 
Javascript :: html to pdf javascript 
Javascript :: read url param data in javascript 
Javascript :: javascript clear child elements 
ADD CONTENT
Topic
Content
Source link
Name
7+6 =