如何将textbox的id传递给.js文件 [英] How to pass id of textbox to.js file
问题描述
我有自动完成的jquery函数,我在.aspx页面本身调用。我将它移动到.js文件。现在它不工作,我不知道怎么打电话。
这里的功能是
< pre lang =cs> $(document).ready(function(){
$(' # <%= txtCity.ClientID%>')。autocomplete( Ashx / Handler.ashx ,
{
延迟: 2 ,
minChars: 2 ,
matchSubset: 1 ,
matchContains: 1 ,
cacheLength: 15 ,
selectFirst: true ,
autoFill: false
}
);
});
< asp:TextBox ID =txtCityclass =tbrunat =serveronchange =reset_CityCode();>
如果我将此查询移动到单独的文件然后如何在aspx页面中调用该函数
问候
CHinnu
(文件).ready( function(){
(' #<%= txtCity.ClientID% >')。自动完成( Ashx / Handler.ashx,
{
延迟: 2 ,
minChars: 2 ,
matchSubset: 1 ,
matchContains: 1 ,
cacheLength: 15 ,
selectFirst: true ,
autoFill: false
}
);
});
< asp:TextBox ID =txtCityclass = tbrunat =serveronchange =reset_CityCode();>
如果我将此查询移动到单独的文件然后如何在aspx页面中调用该函数
问候
CHinnu
您好,
查看此信息。我希望这会对你有所帮助
http://forums.asp.net/t/1384485.aspx [ ^ ]
您必须将文本框的引用传递给外部js文件的函数
>
Hi,
I have a jquery function for autocomplete which i''m calling in the .aspx page itself. I moved it to a .js file. And now its not working, I dont knw how to call.
here is the function
$(document).ready(function () {
$('#<%=txtCity.ClientID%>').autocomplete("Ashx/Handler.ashx",
{
delay: 2,
minChars: 2,
matchSubset: 1,
matchContains: 1,
cacheLength: 15,
selectFirst: true,
autoFill: false
}
);
});
<asp:TextBox ID="txtCity" class="tb" runat="server" onchange="reset_CityCode();">
if I moved this query to a seperate file then how to call the function in the aspx page
Regards
CHinnu
(document).ready(function () {
('#<%=txtCity.ClientID%>').autocomplete("Ashx/Handler.ashx", { delay: 2, minChars: 2, matchSubset: 1, matchContains: 1, cacheLength: 15, selectFirst: true, autoFill: false } ); });
<asp:TextBox ID="txtCity" class="tb" runat="server" onchange="reset_CityCode();">
if I moved this query to a seperate file then how to call the function in the aspx page
Regards
CHinnu
Hello,
Check this out. I hope this will help you
http://forums.asp.net/t/1384485.aspx[^]
You will have to pass reference of textbox to external js file''s function
这篇关于如何将textbox的id传递给.js文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!