**Reasons why id based selectors don't work**

1. The element/DOM with id specified doesn't exist yet.
2. The element exists, but it is not registered in DOM [in case of HTML nodes appended dynamically from Ajax responses].
3. More than one element with the same id is present which is causing a conflict.

**Solutions**

1. Try to access the element after its declaration or alternatively use stuff like `$(document).ready();`

2. For elements coming from Ajax responses, use the `.bind()` method of jQuery. Older versions of jQuery had `.live()` for the same.

3. Use tools [for example, webdeveloper plugin for browsers] to find duplicate ids and remove them.