fixed type in js function for display preview