change to use jquery's function