Please, can anybody tell me how can I access to the value of "41" in this inner script of a website? I just tried this, but it doesnt work
I tried with:
var elem = document.getElementById("back-in-stock-helper");
I only need the number 41, and the example code I need to access is this
<script id="back-in-stock-helper">
var _BISConfig = _BISConfig || {};
_BISConfig.product.variants[0]['inventory_quantity'] = 41;
</script>
Thanks!
Solved:
var elem = document.getElementById("back-in-stock-helper");
var elem2 = elem.textContent;
var ult_pos = elem2.lastIndexOf('=');
var stock = elem2.substring(ult_pos);