I am attempting to grab the value of a span attribute but am only successful so far in grabbing the text (which I don't need in this case).
// I want the value to return "10"
myValue = document.querySelector(".count-total").getElementByID("data-multiply")
console.log(myValue)
<div class="count-total">
<span data-multiply="10">20 Doses</span>
</div>
Target the span with querySelector, and then get the multiply value from the dataset.
const span = document.querySelector('.count-total span');
console.log(span.dataset);
const val = span.dataset.multiply;
console.log(val);
<div class="count-total">
<span data-multiply="10">20 Doses</span>
</div>
Use the dataset attribute: https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/dataset
const node = document.querySelector(".count-total span[data-multiply]")
console.info(node.dataset.multiply)
<div class="count-total">
<span data-multiply="10">20 Doses</span>
</div>
.getElementByID("data-multiply") is neither syntactically correct nor will it get the data attribute
it is spelled getElementById but is used when an element has an ID
You need to use the querySelector with the complete path and use the dataset property
// I want the value to return "10"
const myValue = document.querySelector(".count-total span").dataset.multiply;
console.log(myValue)
<div class="count-total">
<span data-multiply="10">20 Doses</span>
</div>