自动填充文本框出现问题。 [英] Problem with Autocomplete textbox.
本文介绍了自动填充文本框出现问题。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当我们在搜索项目后选择项目时,我有jquery哪个进程或工作。
i have jquery which process or worked when we select item after it search item.
function SearchText() {
$("#txtsearchcourse").autocomplete({
source: function (request, response) {
$.ajax({
type: "POST",
contentType: "application/json; charset=utf-8",
url: '<%=CallingPage %>' + ".aspx/GetAutoCompleteData",
data: "{'strSearchString':'" + document.getElementById('txtsearchcourse').value + "'}",
dataType: "json",
success: function (data) {
response($.map(data.d, function (item) {
return {
label: item.split('##')[0],
val: item.split('##')[1]
}
}));
},
error: function (result) {
alert("Error");
}
});
},
select: function (event, ui) {
document.getElementById('hdnSelectedCourseId').value = ui.item.val;
document.getElementById('txtsearchcourse').value = ui.item.label;
document.getElementById('lnkSearchCourse').click();
}
});
但它在safari浏览器中无法正常运行它没有获得点击&过程项目。什么是问题???
but its not working in safari browser its not getting click & process item. what is problem ???
推荐答案
( # txtsearchcourse)。autocomplete({
source: function (request,response){
("#txtsearchcourse").autocomplete({ source: function (request, response) {
。 ajax({
type: POST,
contentType: application / json; charset = utf-8,
url:' <%= CallingPage%>' + .aspx / GetAutoCompleteData,
data: {' strSearchString':' + document .getElementById(' txtsearchcourse')。value + < span class =code-string> '},
dataType: json,
成功: function (数据){
响应(
.ajax({ type: "POST", contentType: "application/json; charset=utf-8", url: '<%=CallingPage %>' + ".aspx/GetAutoCompleteData", data: "{'strSearchString':'" + document.getElementById('txtsearchcourse').value + "'}", dataType: "json", success: function (data) { response(
.map(data.d, function (item){
return {
label:item.split(' ##' )[ 0 ],
val:item.split(' ##')[ 1 ]
}
}));
},
错误: function (结果){
alert( 错误);
}
});
},
select: function (event,ui){
document .getElementById(' hdnSelectedCourseId')。value = ui.item.val;
document .getElementById(' txtsearchcourse').value = ui.item.label;
document .getElementById(' lnkSearchCourse'< /跨度>)点击();
}
});
.map(data.d, function (item) { return { label: item.split('##')[0], val: item.split('##')[1] } })); }, error: function (result) { alert("Error"); } }); }, select: function (event, ui) { document.getElementById('hdnSelectedCourseId').value = ui.item.val; document.getElementById('txtsearchcourse').value = ui.item.label; document.getElementById('lnkSearchCourse').click(); } });
但它在safari浏览器中无法正常运行它没有获得点击&过程项目。什么是问题???
but its not working in safari browser its not getting click & process item. what is problem ???
这篇关于自动填充文本框出现问题。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文