-1
我有一個asp texbox,它具有佔位符和jquery自動完成功能。兩個工作正常,但在IE8佔位符無法正常工作。爲了使它工作,我在jquery中放置佔位符的水印,但隨後顯示水印,但自動完成不起作用。所有的問題是在IE8:asp文本框佔位符和自動完成不在IE8中一起工作
<asp:TextBox ID="txtLocation" runat="server" CssClass="frmhometxtLocation" placeholder="Locations"
onblur="Javascript:FormatLocation();"></asp:TextBox>
$("#txtLocation")
// don't navigate away from the field on tab when selecting an item
.bind("keydown", function (event) {
if (event.keyCode === $.ui.keyCode.TAB &&
$(this).autocomplete("instance").menu.active) {
event.preventDefault();
}
})
.autocomplete({
delay: 0,
minLength: 1,
source: function (request, response) {
// delegate back to autocomplete, but extract the last term
response($.ui.autocomplete.filter(
locations, extractLast(request.term)));
},
focus: function() {
// prevent value inserted on focus
return false;
},
select: function (event, ui) {
var terms = split(this.value);
// remove the current input
terms.pop();
// add the selected item
terms.push(ui.item.value);
// add placeholder to get the comma-and-space at the end
terms.push("");
this.value = terms.join(", ");
return false;
}
});
});
請描述你得到的錯誤。它並不少見的JavaScript代碼不能與其他瀏覽器一起工作一些時間,並需要一些小的改變。你有沒有包含與IE8一起工作的正確庫? – Aristos
使用水印時出現的錯誤是Microsoft JScript運行時錯誤:對象不支持此屬性或方法 – Anurag