我有这段代码:
<select class="cc-product-variant-selectbox j-product__variants" data-action="changeVariant">
<option class="j-product__variants__item" value="0" data-params="{"price":158,"priceFormatted":"158,00 \u20ac","oldPriceFormatted":"0,00 \u20ac","basicPrice":0,"basicPriceFormatted":"0,00 \u20ac","basicPriceUnit":"&nbsp;","oldPrice":0,"availability":1,"availabilityText":"disponibile","delivery":2,"pool":"Infinity","weightFormatted":"0,1 kg","weight":0.1}"
title="1 metro 158,00 €" content="1 metro" selected="selected">
1 metro 158,00 €</option>
&#13;
我会更改Dropbox文字&#34; 1 metro 158,00€&#34; (即<option>..</option>
之间)&#34; 1地铁&#34;所以没有价格。我在css中尝试了这段代码:
.j-product__variants__item"{content:"1 metro";}
但它不起作用。 我该如何解决?
答案 0 :(得分:0)
快速而肮脏的Javascript解决方案:
// document.querySelectorAll('.j-product__variants__item')[0].innerHTML = document.querySelectorAll('.j-product__variants__item')[0].textContent.replace('158,00 €','');
<body onload="document.querySelectorAll('.j-product__variants__item')[0].innerHTML = document.querySelectorAll('.j-product__variants__item')[0].textContent.replace('158,00 €','');">
<select class="cc-product-variant-selectbox j-product__variants" data-action="changeVariant">
<option class="j-product__variants__item" value="0" data-params="{"price":158,"priceFormatted":"158,00 \u20ac","oldPriceFormatted":"0,00 \u20ac","basicPrice":0,"basicPriceFormatted":"0,00 \u20ac","basicPriceUnit":"&nbsp;","oldPrice":0,"availability":1,"availabilityText":"disponibile","delivery":2,"pool":"Infinity","weightFormatted":"0,1 kg","weight":0.1}"
title="1 metro 158,00 €" content="1 metro" selected="selected">
1 metro 158,00 €</option>
</select>
</body>