I'm using the autocomplete plugin.  The following script works in IE,
but doesn't work in Firefox.  It doesn't appear  that these are even
being triggered.  So when the page displays in Firefox, the
searchStudents textbox has no autocomplete associated with it.

$(document).ready(function() {
    $('#searchStudents').autocomplete('<%=Url.Action("Students",
"Student")%>', {
            dataType: 'json',
            parse: function(data) {
                var rows = new Array();
                for (var i = 0; i < data.length; i++) {
                    rows[i] = { data: data[i], value: data
[i].LastName, result: data[i].LastName };
                }
                return rows;
            },
            formatItem: function(row, i, n) {
                return row.LastName + ' - ' + row.UserId;
            },
            width: 300,
            mustMatch: false,
            limit: 10
        });

        $('#searchStudents').result(function(event, data, formatted) {
            if (data)
                $(this).parent().next().find("input").val(data
["UserId"]);
            $('#Students).append('<option value=' + data["UserId"] +
'>' + data["LastName"] + '</option> ');
        });

        $('#deleteStudents').click(function() {
            $('#Students :selected').each(function(i, selected) {
                $(selected).remove();
            });
        });
    });

Reply via email to