use jQuery attr instead of setAttribute

when appending images.

This was an optimization with no apparent performance benefit.