Can I strip my form of some classes and DIVs?
There are 2 Drupal theme functions which you need to override in your theme's template.php

You can paste this code in your theme's template.php and change "themename" to the name of your theme (Drupal 7 code):

It shouldn't affect any ajax form functions if you have a custom theme, however if you are using a contributed theme you should check the javascript files to see if there are any functions using the classes / selectors you have stripped out.


Override theme_form() to remove the div

function themename_form($variables) {
  $element = $variables['element'];
  if (isset($element['#action'])) {
    $element['#attributes']['action'] = drupal_strip_dangerous_protocols($element['#action']);
}
element_set_attributes($element, array('method', 'id'));
if (empty($element['#attributes']['accept-charset'])) {
 $element['#attributes']['accept-charset'] = "UTF-8";
}
return '' . $element['#children'] . '';
}
Override theme_form_element() function to strip out the classes


function themename_form_element($variables) {
  $element = &amp;$variables['element'];
  $element += array(
    '#title_display' => 'before',
  );
  if (isset($element['#markup']) &amp;&amp; !empty($element['#id'])) {
    $attributes['id'] = $element['#id'];
  }
  // Remove line below if you don't want a custom class
  $attributes['class'] = array('your-custom-class'); 

// Add a class for disabled elements to facilitate cross-browser styling.
  if (!empty($element['#attributes']['disabled'])) {
    $attributes['class'][] = 'form-disabled';
  }
  $output = '' . "\n";
  // If #title is not set, we don't display any label or required marker.
  if (!isset($element['#title'])) {
    $element['#title_display'] = 'none';
  }

$prefix = isset($element['#field_prefix']) ? '' .   $element['#field_prefix'] . ' ' : '';

$suffix = isset($element['#field_suffix']) ? ' ' . $element['#field_suffix'] . '' : '';

switch ($element['#title_display']) {
    case 'before':
    case 'invisible':
      $output .= ' ' . theme('form_element_label', $variables);
      $output .= ' ' . $prefix . $element['#children'] . $suffix . "\n";
      break;

case 'after':
  $output .= ' ' . $prefix . $element['#children'] . $suffix;
  $output .= ' ' . theme('form_element_label', $variables) . "\n";
  break;

case 'none':
case 'attribute':
  // Output no label and no required marker, only the children.
  $output .= ' ' . $prefix . $element['#children'] . $suffix . "\n";
  break;


}

if (!empty($element['#description'])) {
    $output .= '' . $element['#description'] . "\n";
  }

$output .= "\n";

return $output;
}