Why not use jQuery for this and do it in a single, clear line?