2012-04-12 32 views
8

Tôi đang sử dụng giao diện người dùng jquery tự động hoàn tất. Nó hoạt động trong tất cả các trình duyệt khác FF, Chrome, ngoại trừ IE7. Làm việc cho các phiên bản cao hơn của IE cũng nhưng IE7 cung cấp cho các lỗi dưới đây:Jquery UI tự động hoàn tất vấn đề IE 7

SCRIPT3: Member not found. 
jquery.min.js, line 2 character 30636 

Đây là chức năng của tôi:

$('input.autocomplete').each(function() { 
    var $input = $(this); 

    // Set-up the autocomplete widget. 
    var serverUrl = $input.data('url'); 

$(this).autocomplete({ 
    source: function(request, response) { 

    var countrySelect = $("#countrySelect").val(); 

if($input.attr('id') == 'searchJobPostalCode'){ 

    countrySelect = $("#searchJobCountrySelect").val(); 

    }else if($input.attr('id') == 'searchPeoplePostalCode'){ 

    countrySelect = $("#searchUserCountrySelect").val(); 

    } 
    $.ajax({ 
       url: serverUrl, 
       dataType: "json", 
       data: { 
        term: request.term, 
        countrySelect: countrySelect 
       }, 
       success: function(data) { 
         $input.removeClass("ui-autocomplete-loading"); 
         response($.map(data, function(item) { 
         if(typeof item.companyName != 'undefined'){ 
          return { 
           label: item.companyName, 
           value: item.companyName, 
           id: item.companyID 
          } 
        } 

         if(typeof item.locationId != 'undefined'){ 
          return { 
           label: item.postalCode +','+item.placeName+','+item.adminName1+','+item.countryCode, 
           value: item.postalCode +','+item.placeName+','+item.adminName1+','+item.countryCode, 
           postalCode: item.postalCode, 
           city: item.placeName, 
           state: item.adminName1, 
           country: item.countryCode 
          } 
        } 


         //to show user alias autocomplete on compose message 
         if(typeof item.userAlias != 'undefined'){ 
            var label1 = item.userAlias; 
            if(typeof item.city != 'undefined'){ 
             label1 = label1+','+item.city; 
            } 
            if(typeof item.state != 'undefined'){ 
             label1 = label1+','+item.state; 
            } 
            if(typeof item.country != 'undefined'){ 
             label1 = label1+','+item.country; 
            } 

          return { 
           label: item.userAlias, 
           userAlias: item.userAlias 
          } 
        } 

        })); 
       } 
      }); 
     }, 
     minLength: 3,cacheLength:0,keyDelay:900, 
     select: function(event, ui) { 

     $("#companyId").val(ui.item.id); 

     if(typeof ui.item.userAlias != 'undefined'){ 
      $(".toUser").val(ui.item.userAlias); 
     } 

     if(typeof ui.item.postalCode != 'undefined'){ 
       $("#postalCode").val(ui.item.postalCode); 
       $("#city").val(ui.item.city); 
       $("#state").val(ui.item.state); 
       $("#country").val(ui.item.country); 


        if($input.attr('id') == 'searchJobPostalCode'){ 

           $("#searchPostalCodeJobsSearch").val(ui.item.postalCode); 
           $("#searchCityJobsSearch").val(ui.item.city); 
           $("#searchStateJobsSearch").val(ui.item.state); 
           $("#searchCountryJobsSearch").val(ui.item.country); 

        }else if($input.attr('id') == 'searchPeoplePostalCode'){ 

           $("#searchPostalCodePeople").val(ui.item.postalCode); 
           $("#searchCityPeople").val(ui.item.city); 
           $("#searchStatePeople").val(ui.item.state); 
           $("#searchCountryPeople").val(ui.item.country); 

        } 


     } 
     }, 
       change: function(event, ui) { 
       if($(this).attr('id') !='companyName'){ 
         if (ui.item == null) { 
           valid = false; 
          }else{ 
           valid = true; 
          } 
          if (!valid) { 
           // remove invalid value, as it didn't match anything 
           $(this).val(""); 
           select.val(""); 
           input.data("autocomplete").term = ""; 
           return false; 
          } 
         } 
     }, 
     open: function() { 
      $(this).removeClass("ui-corner-all").addClass("ui-corner-top"); 
     }, 
     close: function() { 
      $(this).removeClass("ui-corner-top").addClass("ui-corner-all"); 
      $(this).removeClass("ui-autocomplete-loading"); 

     } 
    }); 

}); 

Tôi cố gắng để gỡ lỗi và nó lỗi ra tại dòng: $(this).autocomplete({

Bất kỳ ý tưởng? Cảm ơn trước

+0

Thử đổi tên lớp 'input' thành một thứ khác ngoài' tự động hoàn thành'. Có lẽ 'input.ac' hay gì đó. Và, nó có vẻ như '$ (this) .autocomplete ({' có thể là '$ input.autocomplete ({' –

+0

Cảm ơn. Điều này đã không giải quyết nó. –

Trả lời

6

Có vẻ như sự cố xảy ra với hệ điều hành của tôi. Tôi đã cài đặt Windows 8 xem trước người tiêu dùng và đang chạy IE bằng cách sử dụng các công cụ dev trong khả năng tương thích IE7. Nó hoạt động trong các cửa sổ 7. cảm ơn.

+0

Cảm ơn vì điều này. Tôi đã kéo –

+0

Dường như giống với IE10 đang chạy trong chế độ IE7 trên Win7. (Win8 có IE10 đi kèm phải không?) Tuy nhiên, nó hoạt động tốt cho IE7 thực chạy trên VirtualPC. – LinusR

0

Tôi đoán là một trong các tập lệnh không tải đúng cách. Điều này xảy ra với tôi một lần, với jquery và IE 7. Đây là cách tôi giải quyết vấn đề này:

Trong HTML, TRƯỚC tất cả các thẻ script của bạn, thêm này:

<script type="text/javascript"></script><!--this is here because of an IE bug--> 

Khi tôi bao gồm dòng trước thẻ của tôi cho jquery.min.js, sự cố đã biến mất.

IE7 là một sự thất vọng.

+0

Đã cố gắng nhưng không may mắn. –

-1

Tôi đã giải quyết với phiên bản thay đổi ui. Bây giờ tôi sử dụng 1.9.1.custom.min.js (trước đây là giao diện người dùng jquery 1.8) và nó hoạt động với khả năng tương thích IE7. Tôi sử dụng jquery v1.7.2

Các vấn đề liên quan