just the same code but done using the jquery methods, for their magics