fixing bug caused by input element was being inserted before document is ready