assets/js/product.js
// (the things in the Product.allProducts array) into the drop down list.
(the things in the Product.allProducts array) into the drop down list.
( the things in the Product . allProducts array ) into the drop down list .
function populateForm() {
  for (var i in Product.allProducts) {
    console.log(Product.allProducts[i]);
    var div = document.createElement("div");
    div.setAttribute("id", "newProduct" + Product.allProducts[i].id);
    div.innerHTML =
      '<div class="col-md-4">' +
      '<div class="productwrap">' +
      '<div class="pr-img">' +
      '<div class="hot"></div>' +
      '<a onclick = "saveIDToLocalStorage(' +
      Product.allProducts[i].id +
      ')" href="productdetails.html"><img src="' +
      Product.allProducts[i].filePath +
      '" alt="" class="img-responsive"></a>' +
      '<div class="pricetag on-sale">' +
      '<div class="inner on-sale"><span class="onsale"><span' +
      'class="oldprice"></span>$' +
      Product.allProducts[i].price +
      "</span></div>" +
      "</div>" +
      "</div>" +
      '<span class="smalltitle"><a onclick = "saveIDToLocalStorage(' +
      Product.allProducts[i].id +
      ')" href="productdetails.html">' +
      Product.allProducts[i].name +
      "</a></span>" +
      '<span class="smalldesc">Item no.: 1000</span>' +
      "</div>" +
      "</div>";
    productContaainer.appendChild(div);
  }
}
function populateForm ( ) { for ( var i in Product . allProducts ) { console . log ( Product . allProducts [ i ] ) ; var div = document . createElement ( "div" ) ; div . setAttribute ( "id" , "newProduct" + Product . allProducts [ i ] . id ) ; div . innerHTML = '<div class="col-md-4">' + '<div class="productwrap">' + '<div class="pr-img">' + '<div class="hot"></div>' + '<a onclick = "saveIDToLocalStorage(' + Product . allProducts [ i ] . id + ')" href="productdetails.html"><img src="' + Product . allProducts [ i ] . filePath + '" alt="" class="img-responsive"></a>' + '<div class="pricetag on-sale">' + '<div class="inner on-sale"><span class="onsale"><span' + 'class="oldprice"></span>$' + Product . allProducts [ i ] . price + "</span></div>" + "</div>" + "</div>" + '<span class="smalltitle"><a onclick = "saveIDToLocalStorage(' + Product . allProducts [ i ] . id + ')" href="productdetails.html">' + Product . allProducts [ i ] . name + "</a></span>" + '<span class="smalldesc">Item no.: 1000</span>' + "</div>" + "</div>" ; productContaainer . appendChild ( div ) ; } }
(the things in the Product.allProducts array) into the drop down list.
( the things in the Product . allProducts array ) into the drop down list .
//TODO: Add an <option> tag inside the form's select for each product // var selectElement = document.getElementById('items'); // var optionElement = document.createElement('option'); // optionElement.textContent = Product.allProducts[i].name; // optionElement.setAttribute('value', Product.allProducts[i].name); // selectElement.appendChild(optionElement); // div.setAttribute("class", "card");