Have a look at http://stackoverflow.com/a/12238895/627806 - you can chain jquery functions - might be a bit more succinct?