Auto_complete_on_select don't work correctly

Hi, i hope that’s the correct place for this question.
I must update two input text from autocomplete. The list is, for
exemple:

  • pippo 1.2 3.0

I want in the value 1.2
and in the value 3.0

I have used auto_complete_on_select but not work.Any suggestion?

The code is:

function auto_complete_on_select(element, selectedElement)
{
document.getElementById(‘inputlat’).value =
selectedElement.childNodes.item.getElementsByTagName(‘span’)[0].innerHTML;
document.getElementById(‘inputlong’).value =
selectedElement.childNodes.item.getElementsByTagName(‘span’)[1].innerHTML;
}

    <input name="comune" class="autocomplete" id="autocomplete" 

size=“20” type=“text” onkeyup=“new Ajax.Autocompleter(‘autocomplete’,
‘autocomplete_choices’, ‘list.php’,
{minChars: 2,afterUpdateElement:
auto_complete_on_select} );”/>

    <br/> lati: <input id="inputlat" type="text" value="-" />
    <br/> long:  <input id="inputlong" type="text" value="-" />

Thanks in advance
max