Is the problem with adding a function to content that has been dynamically added? If so, then you would want to use .on()
and have it look like so:
$("body").on("mouseenter", "span.post-name" function(event) { ("span.post-name").css("color", "red");});