【发布时间】:2017-05-11 15:09:10
【问题描述】:
我正在尝试通过 jquery 访问没有 HTML 的 DIV 中的一段文本(在本例中为“12 个月”)。我知道如果我知道 class 或 id 就可以找到它,但在这种情况下,它似乎无法被抓住。有人可以提供潜在的解决方案吗?
<div class="pms-subscription-plan">
<label>
<input type="radio" name="subscription_plans" data-price="19.99" data-duration="12" value="1219">$19.99 cada 12 meses</label>
<span class="pms-divider"> - </span><span class="pms-subscription-plan-price">19.99</span>
<span class="pms-subscription-plan-currency">$</span>
<span class="pms-divider"> / </span> 12 Months //This piece of text is the one I need to get and change
<div class="pms-subscription-plan-description">Si usted escogió la suscripción $19.99, se le cobrará por esa cantidad anualmente.</div>
</div>
如果有帮助,这里是检查器中看到的代码的打印输出。
【问题讨论】:
-
你想用它做什么?
-
@mr.void 隐藏或更改。
-
$('label').text();
-
stackoverflow.com/questions/16090487/… 的第一个答案解决了这个问题。
标签: javascript jquery html