How to get the HTML content of the odometer counter in ordermeter.js.
<div class='odometer'>1234</div>
<script>
$( '.odometer' ).html(); // not working correctly
</script>
the odometer counter is increased dynamically every 3 seconds. When I try to use the .html() function of jQuery, at times it's giving some weird numbers.
Has odometer.js created a way to access text from the counter?
If you import the OdometerJS library in your page it will transform the divs using class="odometer and so the .html() method wont return the same result as the one you initially wrote in your page
However if you want the value of the integer inside the div you can use .val() or .text()
so in your case
<div class='odometer' id="number">1234</div>
<script>
let x = $( '#number' ).val(); //get the current value of div with id:number
console.log(x); //this will show the value of the #number div at the time of execution
</script>