Set the id property of a form element using D6 Form API? I want to set the id property of an input element of a form that I'm creating in a module using the form API. I'm doing this  I looked up the documentation and it says this:

id
INTERNAL. Used to populate form elements' id property. In rare cases,
you can set this value yourself on a form element, to override the
default setting.

It doesn't really say when I can or can't use it, so I'm hesitant to try to do this, since I can't rely on it.
I'm writing some javascript that has the id of the element hard-coded into it. Should I use the Drupal-generated id in my script instead?
I would avoid changing that at all and use the Drupal-generated IDs in your Javascript. I have never been forced to do otherwise.

Keep in mind, however, that you'll have better luck if you use classes or if you prefer IDs that don't have a node ID or other sequence-based ID in them. For example, I try to avoid using IDs when theming webforms because if I create the webform on another site, the ID will change.

If there are existing styles for what you want to do, I would check which selectors they are using as well.

Remember that you can add your own classes with the theming layer and then you can use them for your Javascript or jQuery. Sometimes this is the best choice, and I've done it numerous times.

If worst comes to worst, implement hook_form_alter and change the #id in question. If your form continues working, then you're good.