Changed the attr function to also return the value when no second parameter is passed.