Fix problem in IE<9, cannot setAttribute for type after appending child to element