Select by id and get the name of the attribute on javascript

I am trying to get a a second value of an element to print it out on another div. This code gives me ‘undefined’ value. What is wrong with this code? I don’t know. What do you think?