tag my tag:

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="&lt;h2&gt;my clicks!&lt;/h2&gt; Group your contacts to target your &lt;span&gt;ASK&lt;/span&gt; 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?

+4
source share
4 answers

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); }); 
0
source

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.

0
source

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/

0
source

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); }); 
0
source

Source: https://habr.com/ru/post/1416353/


All Articles