Changed all the attr() calls to prop() calls after reading this http://api.jquery.com/attr/.