Do not want to display HTML in the title property of the tag
I put the HTML tag in the <a title=""></a>
tag
my <a>
tag:
<a href="/survey/MyClicks/myclicks" class="toolLink" title="<h2>my clicks!</h2> Group your contacts to target your <span>ASK</span> to the specific people you want opinions from.">Clicks</a>
When I click on this tag, it shows the HTML tag as a title, but I do not want to display the HTML tags in the title.
How can i solve this?
You can show the text in the title and then remove the attribute.
var ttext; $('.toolLink').hover(function(){ ttext = $(this).attr('title'); //$('.showTitle').text(ttext); //use only if you are displaying the title text $(this).removeAttr('title'); },function(){ $(this).attr('title', ttext); });
Remove the title
attribute. If it is used, the browser should use it as a tooltip if it wants, and it usually looks like such use is more or less the basic idea of ββthe title
attribute.
If there is a specific reason for the presence of this attribute as the intended effect on search engines, you can save the attribute in HTML, but remove it using client-side JavaScript using the removeAttribute()
method.
Either you must remove the HTML inside the tooltip, otherwise you will need an HTML Tips plugin, such as Tipsy .
Tipsy is a jQuery plugin for creating a tooltip effect on Facebook, based on the attribute of the anchor label header.
Project Page: http://onehackoranother.com/projects/jquery/tipsy/
I am facing the same problem and it is a bit complicated, but I solve this problem using jquery like this.You donβt tag this question with jquery, but I think it will help you.
var attrTitleValue=""; $('#YourAnchorTag').hover(function() { attrTitleValue = $('#YourAnchorTag').attr("title");//Its depend upon you how you find your anchor tag $('#YourAnchorTag').attr("title", ""); }, function() { $('#YourAnchorTag').attr("title", attrTitleValue); });