<div class="quantity-selector">
<span class="quantity-element decrease_qty">-</span>
<span class="quantity-element quantity-digit">1</span>
<input type="hidden" value="1" name="quantity">
<span class="quantity-element increase_qty">+</span>
</div>
尝试从“数量元素数量数字”类获取内部html
最佳答案
如果您想要非 jQuery 方法,这将适用于 IE8 及更高版本(当然也适用于任何其他现代浏览器):
var html = document.querySelector(".quantity-element.quantity-digit").innerHTML;
关于javascript - 从类中获取InnerHTML,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26025439/