How to get rid of the default field markup I need to customize registration form fields. Drupal generates form fields like this:

&lt;div&gt;
 &lt;label&gt;Name&lt;/label&gt;
 &lt;input type="text"&gt;
&lt;/div&gt;


but I need to leave just &lt;input&gt; and be able to add some other tags around it.

For example:

&lt;ul&gt;
&lt;li&gt;&lt;span&gt;Name&lt;/span&gt;&lt;input type="text" /&gt;&lt;/li&gt;
&lt;/ul&gt;


It seems to be a common problem as the default html fields markup don't always what needs to be applied in particular html templates.

What is the best approach to this?
As with pretty much everything like this in Drupal, the answer lies in overriding theme functions/templates. 

That markup is added by the theme_form_element() function; to override the output for that function simply add a function like this to your theme:

function THEMENAME_form_element($vars) {
  // ...
}


And change what you need to from the original function (e.g. replace &lt;div&gt; with &lt;ul&gt; if that's what you need). You might also need to override some of the individual element templates (depending on exactly what you want to do).

Some examples of those:


theme_textfield()
theme_select()
theme_checkbox()