assign css class instead of individual properties in js