swap javascript for jquery