Can you clarify which 'modal dialog' you are referring to. I'm assuming its this one:
http://docs.jquery.com/UI/Dialog
Without seeing more of your code, its difficult. It might be useful if you post the accompanying HTML.
One thing to remember however, is that the modal dialog gives you the impression that you are opening a new window, however in reality the content is in the same HTML document as the rest of your content. This can often lead to confusion when assigning element IDs, for example, some duplicates may be specified.
I'm also assuming that you've debugged/tested to the extent that you are sure your selector is working correctly, i.e. is selecting the item(s) that you intend