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 14
DzynitAsked:
Who is Participating?
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

0
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

0

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.
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

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.
0
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

0
Julian HansenCommented:
Thank you very much.
You are welcome.
0
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.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.