如果有變量 get (SID) 則需要刪除現有的類 (forceview)網址示例:https ://example.com/ ? SID = eqwe7q7e6868我正在獲取變量并嘗試插入顯示(無)。function sid() { // Gets a url that includes the `?` character var url = "somedomain.net?search"; if (url.indexOf("?") > 0) { // Selects elements with the "forceview" class const forceviews = document.getElementsByClassName("forceview"); // Loops through these elements and removes them from display for (let forceview of forceviews){ forceview.style.display = "none"; } console.log("all `.forceview` elements have been hidden"); }}sid();span.old-price.sly-old-price.no-display.forceview { display: inline !important;}<span class="old-price sly-old-price no-display forceview"> <span class="price-container price-final_price tax weee"> <span class="price-label">Pre?o Normal </span> <span id="old-price-1263-final_price" data-price-amount="19.9" data-price-type="oldPrice" class="price-wrapper "> <span class="price">R$19,90</span> </span> </span></span>
如果變量獲取,則刪除類
料青山看我應如是
2021-10-07 20:15:14