Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

using javascript array create bootstrap card

var items = [
  ['Logitek', 'Rp 60.000,00', 'Logitek Keyboard', 'logitek.jpeg'],
  ['MSI', 'Rp 300.000,00', 'MSI Keyboard', 'msi.jpeg'],
  ['Genius', 'Rp 50.000,00', 'Genius Mouse', 'genius.jpeg'],
  ['Jerry', 'Rp 30.000,00', 'Jerry Mouse', 'jerry.jpeg']
]

let content = '';

items.forEach(p => {
  content += `
    <div id="keyBoard" class="col-md-4 mt-2">
              <div class="card" style="width: 18rem;">
                  <img src="${p[3]}" class="card-img-top img-fluid" alt="keyboard">
                  <div class="card-body">
                      <h5 class="card-title" id="itemName">${p[0]}</h5>
                      <p class="card-text" id="itemDesc">${p[2]}</p>
                      <p class="card-text">${p[1]}</p>
                      <a href="#" class="btn btn-primary" id="addCart">Add to cart</a>
                  </div>
              </div>
          </div>
  `
});

document.querySelector("#shop").innerHTML = content;
Comment

using javascript array create bootstrap card

var items = [
  ['Logitek', 'Rp 60.000,00', 'Logitek Keyboard', 'logitek.jpeg'],
  ['MSI', 'Rp 300.000,00', 'MSI Keyboard', 'msi.jpeg'],
  ['Genius', 'Rp 50.000,00', 'Genius Mouse', 'genius.jpeg'],
  ['Jerry', 'Rp 30.000,00', 'Jerry Mouse', 'jerry.jpeg']
]

let content = '';

items.forEach(p => {
  content += `
    <div id="keyBoard" class="col-md-4 mt-2">
              <div class="card" style="width: 18rem;">
                  <img src="${p[3]}" class="card-img-top img-fluid" alt="keyboard">
                  <div class="card-body">
                      <h5 class="card-title" id="itemName">${p[0]}</h5>
                      <p class="card-text" id="itemDesc">${p[2]}</p>
                      <p class="card-text">${p[1]}</p>
                      <a href="#" class="btn btn-primary" id="addCart">Add to cart</a>
                  </div>
              </div>
          </div>
  `
});

document.querySelector("#shop").innerHTML = content;
Comment

PREVIOUS NEXT
Code Example
Javascript :: datepicker auto select off 
Javascript :: Convert pixels to number js 
Javascript :: react fetch request with content type x-www-form-urlencoded 
Javascript :: object declaration in javascript 
Javascript :: winston logger levels 
Javascript :: java script to send email 
Javascript :: build json object 
Javascript :: alex morgan 
Javascript :: react-phone-number-input properties 
Javascript :: javascript not running 
Javascript :: remove shadow in jquery 
Javascript :: automated counter with react hooks 
Javascript :: react native full screen view video player 
Javascript :: vuejs pass data to router-view 
Javascript :: Ocultar un elemento cuando la ventana cambia de tamaño css 
Javascript :: javascript convert string to bool 
Javascript :: bouton scroll en haut 
Javascript :: javascript set() handler 
Javascript :: using sequelize to read from a table 
Javascript :: cypress/react yarn 
Javascript :: javascript reduce return array 
Javascript :: transition css with js 
Javascript :: react add splite image 
Javascript :: The toUpperCase JavaScript string method 
Javascript :: how to update json key name while keeping the values in mysql 
Javascript :: add material angular 
Javascript :: filter in javascript practice exercise 
Javascript :: sum up all the first and last digit of a number until only two digits are left 
Javascript :: how to host a react website 
Javascript :: ckeditor ignore contenteditable 
ADD CONTENT
Topic
Content
Source link
Name
1+8 =