Use getAttribute('class') instead of className directly.