Probably, it is getValue() that is undefined.
Probably you need to use
A <div> doesn't have a value. And even for elements that do have values, you would use
.value and not
An optimist sees the glass as half full.
A pessimist sees the glass as half empty.
A realist drinks it no matter how much there is.