I don't think that $('<div class="tooltip-box"><p></p></div>')
is a valid jQuery selector (I could be wrong).
I would recommend not trying to always get everything on one line. Try something like this (untested):
jQuery(document).ready(function($){
$("a.tooltip").hover(function () {
var titleText=$(this).attr("title");
$(this).after("<div id='tooltip-box'>" +titleText+ "</div>");
}, function () {
$("div#tooltip-box").remove();
});
$("a.tooltip").on("click", function(event){
event.preventDefault();
});
});
You will of course need to style the div with your own CSS.
Good luck!