goods.forEach(p => {
if (p.sort.indexOf(sort.join(" ")) != -1) {
const product = document.createElement("a");
product.href = `pages/product.html?${p.id}`;
product.className = "products__item";
product.target = "_blank";
product.innerHTML = `<div class="product-img">
<img src="assets/img/product${p.id}.png" alt="${p.title}" />
</div>
<h3 class="product-txt">
${p.title}
</h3>
<p class="product-desc">
Get the most out of your music with an experience.
</p>
<div class="pricing">
<p class="price product-txt">
$${p.price}
</p>
<ul class="stars">
<li class="star star_painted"></li>
<li class="star star_painted"></li>
<li class="star star_painted"></li>
<li class="star star_unpainted"></li>
<li class="star star_unpainted"></li>
</ul>
</div>`;
productsList.append(product);
}
});
detailCount.addEventListener("input", function() {
let val = this.value;
if (val.indexOf(".") !== -1 && val[0] != ".")
this.value = val.substr(0, val.indexOf("."));
else if (val.indexOf(" ") !== -1 || isNaN(val)) {
this.value = val.replace(/[^\d]/g, "");
} else if (val[0] == 0 || val[0] == ".") this.value = val.slice(1);
if (this.value == "") this.value = 1;
if (+val > 99) this.value = 99;
});
Нужно извлечь LocalityName