Posted By

vagrantradio on 02/16/10


Tagged

javascript image alt jquery title


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

alejandrosuch


JQUERY GRAB IMAGE ALT AND ADD AS A TITLE


 / Published in: jQuery
 

grabs image alt or src and appends it to a title

  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  

You need to login to post a comment.