HTML
<div class="slider-container slide-0" num-slides="5" rel="0"></div>
JS
var maxNum = parseInt($('.slide-0').attr("num-slides"));
// maxNum = NaN
var maxNum = parseInt($('.slide-0').attr("num-slides").value);
// "Uncaught TypeError: Cannot read property 'value' of undefined"
var maxNum = parseInt($('.slide-0').attr("num-slides").val());
// Uncaught TypeError: Cannot read property 'val' of undefined
var maxNum = Number($('.slide-0').attr("num-slides"));
// maxNum = NaN
Currently:
When I run the program in Google Chrome 64.0, parseInt and Number does not return a numeric value. However, when I type the code into the dev tools console:
parseInt($('.slide-0').attr("num-slides"));
// returns 5 (not string)
Any ideas why this might be the case?