Better way to write jQuery methods