this is just a small issue. Not really a problem. I’ve got these codes:
$('.gallery a').attr('href', href);
$('.gallery a').find('img').attr( 'src', dir + '/img/design/' + img );
is it possible to combine them something like this?
$('.gallery a').attr('href', href).find('img').attr( 'src', dir + '/img/design/' + img );
Yes. The documentation says that
.attr( attributeName, value )returns jQuery, so you can chain it like that.Just remember that not everything is chainable (i.e. you obviously can’t chain from functions that have a return value, so check the documentation if you’re unsure).