Correct the jQuery element visibility check