hasClass returning false despite selecting based on class

hasClass returning false despite selecting based on class

So I'm selecting elements based on their class, for example:

  • $.each($('#gender_chart .nv-slice'), function(i, value) { }); OR
  • $('#gender_chart .nv-slice').each(function() { });

No matter which I use, if I then print out hasClass() for $(this/value), I get false. For example:

  • console.log($(this).hasClass('nv-slice))
  • console.log($(value).hasClass('nv-slice))

As you can see, I'm looping through all elements with the class 'nv-slice', but then calling hasClass('nv-slice') on any of these elements returns false.

Any help is much appreciated.