Modifying a jQuery plugin, I have lines of code as follows:
var currentread = (self).find('.c'+a).html();
//currentread = currentread.toUpperCase();
$('#output').html(currentread);
With the middle line commented out, the code works fine. The contents of the div with the class ‘c[1-n]’ is displayed in #output. Uncommenting the middle line to convert this to upper case, however, generates the error ‘currentread is null’ for that line.
I must be doing something stupid here, but this doesn’t seem to make sense. Any idea?
Is is simply the case that
currentreadis null? You could change it to:so that toUpperCase is always called on a string.