updading code to use just jquery rather then mix of vanilla js jquery