Change attribute title to data-title in link.

I've used css to style the tooltips on linkes here: https://www.searchcommander.com/ but as you can see by hover over the links in the very top menu in blue (sub-menu of the first link), after hovering for a few seconds, the default browser tooltip also shows up.  I found some info suggesting to change "title" to "data-title" in the links, but because this is a wordpress menu, I can't do that manually.

I found a couple jquery exmples that are supposed to do that, but nothing worked.

Anyone have any other ideas to try?
LVL 15
DzynitAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Julian HansenCommented:
You could try something like this (although changing the source - 100% better solution)
<script>
$(function() {
  // FOR EACH ELEMENT WITH A 'title' ATTRIBUTE
  $('[title]').each(function() {
    // CREATE A data-title ATTRIBUTE WITH VALUE OF TITLE
    // AND CLEAR THE title ATTRIBUTE
    $(this).attr('data-title', $(this).attr('title')).attr('title','');
  });
});
</script>

Open in new window

Julian HansenCommented:
The above works on your site in that it empty title and populates title - I am assuming you still need to make changes to make tooltip recognise data-title.

Also note you will need to use the no-conflict notation for jQuery i.e.
jQuery('[title]').each(function() {
    // CREATE A data-title ATTRIBUTE WITH VALUE OF TITLE
    // AND CLEAR THE title ATTRIBUTE
    jQuery(this).attr('data-title', jQuery(this).attr('title')).attr('title','');
  });

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
DzynitAuthor Commented:
I tried that both in the head area and then tried at the end of the body, but it's still not changing it. I'm not showing any jquery errors in my browser either.
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

DzynitAuthor Commented:
Thank you very much. There must be a problem with my firefox browser today. When I looked in chrome I do see it working. It's not in firefox for me yet.
Julian HansenCommented:
Looking at the source for your page I see this
<script>
jQuery('[title]').each(function() {
    // CREATE A data-title ATTRIBUTE WITH VALUE OF TITLE
    // AND CLEAR THE title ATTRIBUTE
    jQuery(this).attr('data-title', jQuery(this).attr('title')).attr('title','');
  });    
</script>

Open in new window

You need to wrap this code in a document load so it should be this
<script>
jQuery(function() { // ON DOCUMENT REDY
  jQuery('[title]').each(function() {
    // CREATE A data-title ATTRIBUTE WITH VALUE OF TITLE
    // AND CLEAR THE title ATTRIBUTE
    jQuery(this).attr('data-title', jQuery(this).attr('title')).attr('title','');
  });    
});
</script>

Open in new window

Julian HansenCommented:
Thank you very much.
You are welcome.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
jQuery

From novice to tech pro — start learning today.