getElementById returns null?

It can be caused by: Invalid HTML syntax (some tag is not closed or similar error) Duplicate IDs – there are two HTML DOM elements with the same ID Maybe element you are trying to get by ID is created dynamically (loaded by ajax or created by script)? Please, post your code.