i created a very small mvc4 internet application that has an autocomplete textbox on the home page. everything worked fine until i updated jquery using the nuget package manager to version 1.8.2, since then i get an Microsoft JScript runtime error: Object doesn't support this property or method error thrown by this function:
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;
in the jquery-ui-1.8.20.js file.
this is how i call my script and styles in the _Layout.cshtml page:
@Styles.Render("~/Content/css")
@Styles.Render("~/Content/themes/base/css")
@Scripts.Render("~/bundles/jquery")
@Scripts.Render("~/bundles/jqueryui")
@RenderSection("scripts", required: false)
and the home page with the textbox:
@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>
}
i tried changing the order of the scripts and styles call but it didn’t help.
the same code worked perfectly before the update.
any help would be appreciated.
EDIT:
i downloaded the newest jquery-ui files and added them to my project. I’m not receiving any errors now but when typing something to the textbox it looks like this:
(the suggestions hide a part of the textbox and the bullets are visible),
after a refresh the suggestion are located fine but the bullets are still visible.
so i downloaded the newest jquery files and replaced the ones installed by nuget, no luck!
eventually i copied the content directory and the scripts directory form a new mvc4 project and everything works.