I'm about to create a very simple tooltip solution for my website based on jquery. Im using the following script:
jQuery(document).ready(function($){
$("a.tooltip").hover(function () {
$('<div class="tooltip-box"><p></p></div>').text($this.attr('title')).appendTo(this);
}, function () {
$("div.tooltip-box").remove();
});
$("a.tooltip").on("click", function(event){
event.preventDefault();
});
});
The markup:
<a href="#" title="Tooltip text here" class="tooltip"></a>
Somehow it isn't working at the moment. I tried a lot myself and searched here but can't figure it out. Sorry if is only simple syntax error. I'm a jquery beginner. Thanks for your help!