gpt4 book ai didi

html - 在 ... 之间更改文本

转载 作者:行者123 更新时间:2023-11-28 04:33:40 26 4
gpt4 key购买 nike

我有这个代码:

<select class="cc-product-variant-selectbox j-product__variants" data-action="changeVariant">
<option class="j-product__variants__item" value="0" data-params="{&quot;price&quot;:158,&quot;priceFormatted&quot;:&quot;158,00 \u20ac&quot;,&quot;oldPriceFormatted&quot;:&quot;0,00 \u20ac&quot;,&quot;basicPrice&quot;:0,&quot;basicPriceFormatted&quot;:&quot;0,00 \u20ac&quot;,&quot;basicPriceUnit&quot;:&quot;&amp;nbsp;&quot;,&quot;oldPrice&quot;:0,&quot;availability&quot;:1,&quot;availabilityText&quot;:&quot;disponibile&quot;,&quot;delivery&quot;:2,&quot;pool&quot;:&quot;Infinity&quot;,&quot;weightFormatted&quot;:&quot;0,1 kg&quot;,&quot;weight&quot;:0.1}"
title="1 metro 158,00 €" content="1 metro" selected="selected">
1 metro 158,00 €</option>

我会在“1 metro”中更改保管箱文本“1 metro 158,00 €”(介于 <option>..</option> 之间),因此没有价格。我在 css 中试过这段代码:

.j-product__variants__item"{content:"1 metro";}

但它不起作用。我该如何解决?

最佳答案

快速而肮脏的 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="{&quot;price&quot;:158,&quot;priceFormatted&quot;:&quot;158,00 \u20ac&quot;,&quot;oldPriceFormatted&quot;:&quot;0,00 \u20ac&quot;,&quot;basicPrice&quot;:0,&quot;basicPriceFormatted&quot;:&quot;0,00 \u20ac&quot;,&quot;basicPriceUnit&quot;:&quot;&amp;nbsp;&quot;,&quot;oldPrice&quot;:0,&quot;availability&quot;:1,&quot;availabilityText&quot;:&quot;disponibile&quot;,&quot;delivery&quot;:2,&quot;pool&quot;:&quot;Infinity&quot;,&quot;weightFormatted&quot;:&quot;0,1 kg&quot;,&quot;weight&quot;:0.1}"
title="1 metro 158,00 €" content="1 metro" selected="selected">
1 metro 158,00 €</option>
</select>
</body>

关于html - 在 <option=class>...</option> 之间更改文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41611348/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com