javascript - 如何使用下拉列表触发 Jquery 函数?

标签 javascript .net jquery asp.net

我有 2 个带有 OnSelectedIndexChanged 属性的 asp:DropdownLists。当它被触发时,我想运行一个 jquery 函数,让用户知道数据正在处理。我如何跳转到我的 jQuery 函数,有没有一种方法我不必使用唯一的 id?

<asp:DropDownList ID="ddlFirst" runat="server" OnSelectedIndexChanged="ddlChange"> 
    <asp:ListItem>All</asp:ListItem>
    <asp:ListItem>None</asp:ListItem>
</asp:DropDownList>

<asp:DropDownList ID="ddlSecond" runat="server" OnSelectedIndexChanged="ddlChange"> 
    <asp:ListItem>All</asp:ListItem>
    <asp:ListItem>None</asp:ListItem>
</asp:DropDownList>

$(document).ready(function () {
$("???").change(function () {
    //code
});
});

最佳答案

给他们一个类并使用$('.yourClass')

关于javascript - 如何使用下拉列表触发 Jquery 函数?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5005135/

相关文章:

jquery - FOSJsRoutingBundle : Cannot Generate routing url inside javascript

javascript - 动态生成表时,如何使用 Python BeautifulSoup 对表信息进行 scape?

JavaScript (Rhino) 使用库或包含其他脚本

javascript - 在 JavaScript 中按属性过滤 JSON 数据

.net - 以编程方式创建 Excel 实例并加载所有加载项

c# - 在 C# 中,搜索列表中的元素但执行 "StartsWith()"搜索的最快方法是什么?

javascript - 带有JS确认对话框的广播按钮验证

Javascript:location.hostname 和 document.domain 之间的区别?

c# - 如何跟踪 WCF 序列化问题/异常

javascript - 优雅的 Javascript 降级 - 外部源文件