JQUERY GRAB IMAGE ALT AND ADD AS A TITLE


/ Published in: jQuery
Save to your folder(s)

grabs image alt or src and appends it to a title


Copy this code and paste it in your HTML
  1. $("img:not([title])").each(function() {
  2. if($(this).attr("alt") != '') $(this).parent().attr("title", $(this).attr("alt"))
  3. else $(this).parent().attr("title", $(this).attr("src"));
  4. });

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.