Using autoComplete in a dialog

Using autoComplete in a dialog

Hello,
I want to use autocomplete on an input field in a dialog.

The script is working fine, but I have some display problems.

My Code:

  1. function lookup(inputString) {
            if(inputString.length == 0) {
                // Hide the suggestion box.
                $('#suggestions').hide();
            } else {
                $.post("/jquery/autoComplete/rpc.php", {queryString: ""+inputString+""}, function(data){
                    if(data.length >0) {
                        $('#suggestions').show();
                        $('#autoSuggestionsList').html(data);
                    }
                });
            }
        } // lookup
        
        function fill(thisValue) {
            $('#inputString').val(thisValue);
            setTimeout("$('#suggestions').hide();", 200);
        }
            
        
        </script>    
        <div style="display:none" id="dialog1" title="Dateibeschreibung bearbeiten">
            <form id="dateidesc1" action="" method="post">
                Empfänger:
                <input class="inputh2" name="empfaenger" value="Spiele durchsuchen" onFocus="this.value=this.value=='Spiele durchsuchen'?'':this.value" onBlur="this.value=this.value==''?'Spiele durchsuchen':this.value; fill();" id="inputString" onKeyUp="lookup(this.value);"/>
                <div class="suggestionsBox" id="suggestions" style="display: none;">
                    <div class="suggestionList" id="autoSuggestionsList">
    &nbsp;                </div>
                </div>
                Text:
                <textarea name="beschreibung" class="inputh"></textarea>
                <input type="submit" class="buttonabsenden" name="editbeschreibung" value="" />
            </form>
        </div>    
        <script type="text/javascript">    
      $(document).ready(function() {
            var $dialog = $('<div></div>')
                .html(document.getElementById("dialog1").innerHTML)
                .dialog({
                    autoOpen: false,
                    title: 'Nachricht schreiben',
                    width: 500,
                    height: 265,
                });

            $('#openmsg').click(function() {
                $dialog.dialog('open');
            });
        })















































The dialog is working fine, also Firebug tells me that the data is transferred successfully. It only works outside the dialog. But in the dialog, the results aren't showing up.

What is my mistake?

Thank you :)