2012-11-14 197 views
0

我創建了一個非常小的mvc4互聯網應用程序,在主頁上有一個自動完成文本框。一切正常,直到我使用的NuGet軟件包管理器1.8.2版本更新jQuery的,從那以後,我得到一個Microsoft JScript runtime error: Object doesn't support this property or method錯誤此函數拋出:在jquery-ui-1.8.20.js文件錯誤安裝jquery包後

function reduce(elem, size, border, margin) { 
    $.each(side, function() { 
    size -= parseFloat($.curCSS(elem, "padding" + this, true)) || 0; 
     if (border) { 
      size -= parseFloat($.curCSS(elem, "border" + this + "Width", true)) || 0; 
     } 
     if (margin) { 
      size -= parseFloat($.curCSS(elem, "margin" + this, true)) || 0; 
     } 
    }); 
    return size; 

這是我叫我在_Layout.cshtml網頁腳本和樣式:

@Styles.Render("~/Content/css") 
@Styles.Render("~/Content/themes/base/css") 
@Scripts.Render("~/bundles/jquery") 
@Scripts.Render("~/bundles/jqueryui") 
@RenderSection("scripts", required: false) 

,並與文本框的主頁:

@using (Html.BeginForm("AutoComplete", "Home", FormMethod.Get, new { style = "text-align: center;" })) 
{ 
    <input type="text" id="autocomplete" name="key" data-autocomplete=" @Url.Action("AutoCompleteData", "Home")" /> 
} 
@section scripts{ 
    <script type="text/javascript"> 
     $(document).ready(function() { 
      $('#autocomplete').each(function() { 
       $(this).autocomplete({ 
        source: $(this).attr('data-autocomplete') 
       }); 
      }); 
     }); 
    </script> 
} 

我試圖改變的順序腳本和樣式調用但它沒有幫助。
相同的代碼在更新之前完美工作。
任何幫助,將不勝感激。

編輯: 我下載了最新的jquery-ui文件,並將它們添加到我的項目中。我現在沒有收到任何錯誤,但當輸入文本框時,它看起來像這樣:autocomplete
(建議隱藏文本框的一部分,子彈是可見的), 刷新後建議位於罰款,但子彈仍然可見。

回答

0

因此我下載了最新的jquery文件,並將其替換爲由nuget安裝的,沒有運氣! 最終我複製的內容目錄和腳本目錄形成一個新的mvc4項目,一切正常。

0

.curCSS()已被棄用一段時間,現在已經被取出jQuery。
它必須由.css()方法替換。嘗試使用最新版本的jQuery UI。
請參閱http://bugs.jquery.com/ticket/11921