と を使用jquery 1.9.1.js
してjquery-ui-1.10.3.custom.min.js
います。IE9 ブラウザーで実行すると、エラーが発生します"Unable to get value of the property 'toLowerCase': object is null or undefined"
。以下は私のコードです。
$("input[id^='TextBoxAssociate']").autocomplete(
{
source: function (request, response) {
$.ajax({
type: "POST",
contentType: "application/json; charset=utf-8",
url: "CreateEditRequest.aspx/GetEmpNames",
data: "{'empName':'" + $(this).val() + "'}",
dataType: "json",
success: function (data) {
response($.map(data.d, function (el) {
return {
label: el.EmpName,
value: el.EmpId
};
}));
},
error: function (result) {
alert("Error");
}
});
}
一部をコメントする response($.map(data.d, function (el) { ... }
と、エラーは発生せず、出力されません。バージョン管理またはブラウザの互換性に問題がある可能性があります。私もie8で試しました。また、追加して確認してください
<meta http-equiv="X-UA-Compatible" content="IE=EDGE" />
しかし、私にはうまくいかず、タイトルに上記のメッセージが表示されています。
エラーは jquery.1.9.1.js にあります
val: function( value ) {
var ret, hooks, isFunction,
elem = this[0];
if ( !arguments.length ) {
if ( elem ) {
hooks = jQuery.valHooks[ elem.type ] || jQuery.valHooks[ elem.nodeName.toLowerCase() ];
if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) {
return ret;
}
ret = elem.value;
return typeof ret === "string" ?
// handle most common string cases
ret.replace(rreturn, "") :
// handle cases where value is null/undef or number
ret == null ? "" : ret;
}
return;
}