...
let li_elements = document.getElementsByTagName("li") for (let i = 0; i < li_elements.length; i++){ if (li_elements[i].textContent.includes("SALE")){ console.log(li_elements[i].childNodes[0]) li_elements[i].childNodes[0].style.color = "red"; } } window.onload = function(e){ let elements = document.getElementsByClassName("cmp-product-thumb") $(".category-item-placeholder").css("min-height", elements[0].offsetHeight) } function addCSSRule(selector, rules) { var styleElement = document.createElement('style'); styleElement.type = 'text/css'; // Modern browsers if (styleElement.styleSheet) { styleElement.styleSheet.cssText = selector + "{" + rules + "}"; } else { styleElement.appendChild(document.createTextNode(selector + "{" + rules + "}")); } // Append the style element to the head of the document document.head.appendChild(styleElement); } // Example usage: addCSSRule('.MuiDialog-container img', 'max-height:89vh;'); addCSSRule('.MuiDialog-container img', 'object-fit: contain !important;');