Wednesday, December 30, 2009

[jQuery] Re: autocomplete plugin not working in firefox

Do you have FireBug installed (you should!) to see if the plugin at
least tries to make the request?

http://www.getfirebug.com

On Dec 30, 8:23 pm, mary ann <marya...@gmail.com> wrote:
> 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();
>             });
>         });
>     });

No comments: