set content of preview modal in javascript