Skip to content

Instantly share code, notes, and snippets.

@glennyboy
Last active June 4, 2021 19:19
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 glennyboy/a3efe9bb4706aea8b6e63bcbe7eebaab to your computer and use it in GitHub Desktop.
Save glennyboy/a3efe9bb4706aea8b6e63bcbe7eebaab to your computer and use it in GitHub Desktop.
jQuery Set Image TITLE from ALT Tag
jQuery(document).ready(function($) {
$("img:not([title])").each(function() {
if($(this).attr("alt") != '') $(this).attr("title", $(this).attr("alt"));
else $(this).attr("title", $(this).attr("src"));
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment