Just wondering why do I get an output of NaN not 100 using this code (the class was changed to time recur by the way, it's not on the screenshot but keep it in mind):
z = +(document.getElementsByClassName("time recur").innerHTML)
Just wondering why do I get an output of NaN not 100 using this code (the class was changed to time recur by the way, it's not on the screenshot but keep it in mind):
z = +(document.getElementsByClassName("time recur").innerHTML)
getElementsByClassName returns an array.
z = +(document.getElementsByClassName("time recur")[0].innerHTML)
By the way,I can't see the class 'recur' in your element. You might need to ignore it in JavaScript
Because getElementsByClassName returns array.
z = +(document.getElementsByClassName("time recur")[0].innerHTML)
You have to do something like this:
z = + parseInt((document.getElementsByClassName("time recur")[0].innerHTML));
When you select element by class, you might get more than one matched element, so you have to select first with index 0. And then, you have to convert it to Integer in order to use in math operation. Hope this helps.