replace element and use its class