Skip to content

Instantly share code, notes, and snippets.

@spigotdesign
Created July 10, 2018 23:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save spigotdesign/f35d82c38b980aff8f0325ba7861ede5 to your computer and use it in GitHub Desktop.
Save spigotdesign/f35d82c38b980aff8f0325ba7861ede5 to your computer and use it in GitHub Desktop.
Hide title attribute on hover, but don't remove
$(".element").hover(function(){
// Get the current title
var title = $(this).attr("title");
// Store it in a temporary attribute
$(this).attr("tmp_title", title);
// Set the title to nothing so we don't see the tooltips
$(this).attr("title","");
});
$(".element").click(function(){// Fired when we leave the element
// Retrieve the title from the temporary attribute
var title = $(this).attr("tmp_title");
// Return the title to what it was
$(this).attr("title", title);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment