moved set input attribute test for readability