I think it is because the tooltip documentation says the content:
method should be a callback or a string
Multiple types supported:
Function: A callback which can either return the content directly,
or call the first argument, passing in the content, e.g.,
for Ajax content.
String: A string of HTML to use for the tooltip content.
I edited your code by creating a named function and referencing it in the content method. And it seems to work as expected.