a better jQuery DOM manipulation on setTemplate