我正在使用下面编写的脚本进行自动完成。当我在我的母版页中添加 jquery-1.8.3.js 时它正在工作,但是当我从母版页中删除它并将其添加到特定页面时,它停止工作。我不知道为什么会导致这个问题。
<script type="text/javascript">
function pageLoad(sender, args) {
$(function () {
$(".tb").autocomplete({
source: function (request, response) {
$.ajax({
url: "AutoInsuranceCompanyList.asmx/FetchCompanyList",
data: "{ 'cmp': '" + request.term + "' }",
dataType: "json",
type: "POST",
contentType: "application/json; charset=utf-8",
dataFilter: function (data) { return data; },
success: function (data) {
response($.map(data.d, function (item) {
return {
value: item.INSCO
}
}))
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
alert(textStatus);
}
});
},
minLength: 1
});
});
}
</script>
<asp:UpdatePanel ID="UpdatePanel3" UpdateMode="Conditional" Visible="true" RenderMode="Inline"runat="server">
<ContentTemplate>
<ul class="formList">
<li class="clear">
<label>
Insurance Company:</label>
<asp:TextBox ID="txtInsuranceCompany" class="tb" runat="server" MaxLength="40"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator33" runat="server" ControlToValidate="txtInsuranceCompany" ErrorMessage="Please enter insurance company name" ForeColor="Red" SetFocusOnError="True"></asp:RequiredFieldValidator>
</li>
</ul>
</ContentTemplate>
</asp:UpdatePanel>
在浏览器运行时它显示
<input id="ContentPlaceHolder1_txtInsuranceCompany" class="tb ac_input" type="text" autocomplete="off" maxlength="40" name="ctl00$ContentPlaceHolder1$txtInsuranceCompany">
请帮忙