JS - Image attribute- Auto alt text

by barkkathulla 2014-04-05 11:41:27


You can add alternate text in an image by this attribute...

$(document).ready(function() {
$('picturediv').each(function(){
var $pict = $(this);
var filename = $pict.attr('src')
$pict.attr('alt', filename.substring(0, filename.lastIndexOf('.')));
});
});
508
like
0
dislike
0
mail
flag

You must LOGIN to add comments