ul list with ajax items is not build correctly I have an ul list, which is build with default items, depending on a dropdown value.
When I change the dropdown, the area with the ul should be replaced by ajax with new items depending on the selected dropdown value.
The problem is:
After replacing the div with the ul inside, the ul tag is opened and closed immediately, the li items are generated directly after the ul closing tag.
Here is some sample code:

 $drop_value=isset($form_state['values']['dropdown'])?$form_state['values']['dropdown']:$default_value;
 $form['images']['drop_area'] = array(
  '#markup' =&gt; '
    &lt;div class="ui-widget ui-helper-clearfix"&gt;
      &lt;div id="newloc" class="ui-widget-content ui-state-default"&gt;
        &lt;ul id="newloclist_ul" class="itemlist ui-helper-reset ui-helper-clearfix"/&gt;
        '.get_items($drop_value).'
        &lt;/ul&gt;
      &lt;/div&gt;    
    &lt;/div&gt;',
  '#prefix' =&gt; '&lt;div id="drop_area"&gt;',
  '#suffix' =&gt; '&lt;/div&gt;',
);
function get_items($drop) {
  ...
  //builds li elements
  return $li_elements;
}


The ajax event is assigned to the dropdown.
The output is correct after loading the page with the $default_value. 
After changing the dropdown, the li elements are generated correctly, but the resulting html looks like this:

&lt;ul id="newloclist_ul" class="itemlist ui-helper-reset ui-helper-clearfix"&gt;&lt;/ul&gt;
&lt;li class="ui-widget-content ui-corner-all"&gt;item&lt;/li&gt;
...


Why do the li elements are generated outside the ul, although the function for generating the items is called inside the ul markup?
I also tried to declare a variable before the markup, holding the result of the get_items function, but this has the same effect...

Thx.
$drop_value=isset($form_state['values']['dropdown'])?$form_state['values']['dropdown']:$default_value;
$form['images']['drop_area'] = array(
'#markup' =&gt; '
&lt;div class="ui-widget ui-helper-clearfix"&gt;
  &lt;div id="newloc" class="ui-widget-content ui-state-default"&gt;
    &lt;ul id="newloclist_ul" class="itemlist ui-helper-reset ui-helper-clearfix"/&gt;
    '.get_items($drop_value).'
    &lt;/ul&gt;
  &lt;/div&gt;    
&lt;/div&gt;',
'#prefix' =&gt; '&lt;div id="drop_area"&gt;',
'#suffix' =&gt; '&lt;/div&gt;',
);
function get_items($drop) {
  ...
  //builds li elements
  return $li_elements;
}


In your above code try after remove the "/" at the end of ul tag.

Then your code should be :

&lt;ul id="newloclist_ul" class="itemlist ui-helper-reset ui-helper-clearfix"&gt;