window.onload = function() { var products = document.querySelectorAll('.product'); products.forEach(function(product) { // Check some condition to apply the discount if (/* condition */) { var discountLabel = document.createElement('div'); discountLabel.className = 'discount-label'; discountLabel.innerText = '40% OFF'; product.appendChild(discountLabel); } }); };
اعثر على كل ما تريد
اعثر على كل ما تريد