I was working on a patch for poll module today when I made a wonderful discovery.The AHAH (similar to AJAX) enhancements for Drupal core work with all DOM elements, not just form elements (like buttons and select lists). All the code necessary is already in Drupal core, though the following implementation with poll module is still in progress.
$ahah_binding = array( 'url' => url('poll/js'), 'event' => 'click', 'wrapper' => 'poll-choices', 'selector' => '#edit-poll-more', 'effect' => 'slide', 'method' => 'append', 'progress' => array('type' => 'throbber'); ); drupal_add_js('misc/jquery.form.js'); drupal_add_js('misc/ahah.js'); drupal_add_js(array('ahah' => array($element['#id'] => $ahah_binding)), 'setting'); return 'Click here for more choices';
This is a totally untested example, but it shows the necessary code to add AHAH to any element on the page, not just form items. It's pretty cool, and I hope that AHAH will aid in the battle for better usability in Drupal.