(Drupal 6)
What won't(?) work: custom form element, drupal_render() and #ahah
#ahah does not look like it will work in general, because it looks like it attaches and selects things based on #id, which isn't(?) unique across the whole page if you are printing out more than one thing which you want to be editable in page.
Pure jQuery solution
Step 1: Print out a placeholder element that can be selected (i.e. has an #id)
Step 2: Attach a handler to it
Step 3: Create a drupal menu callback
Create a menu callback called mymodule/js/form
Do some craziness with the form_get_cache and form_set_cache
Return the HTML to be added with:
drupal_json(array('status' => TRUE, 'data' => $output));
Step 4: Put the result of the callback into the page
