Should be able to use `$.each` here see: http://api.jquery.com/jQuery.each/