ASP DDL jquery 选择器
当服务器处理控件时,下拉列表 ID 会被修改,因此它们不再是 SimpleDDL,而是变成 cph_main_SimpleDDL 或类似的东西。
我有一个采用 DDL ID 的 jQuery 方法,但当 DDL 名称更改时它不起作用。
我可以使用什么 JS 函数来拆分 ID 名称并仅获取 SimpleDDL 部分?
我知道如何通过这样做来选择名称的这个特定部分:
$('select[id$=SimpleDDL]')
但我只需要获取 ID 名称的一部分并将其分配给一个变量。
谢谢!
The drop down lists IDs get modified when the control is handled by the server so instead of SimpleDDL they become cph_main_SimpleDDL or something like that.
I have a jQuery method that takes the DDL ID, but it doesn't work as the DDL names change.
What JS function can I use to split the ID name and get just the SimpleDDL part?
I know how to select this particular part of the name by doing this:
$('select[id$=SimpleDDL]')
but I need to just get a part of the ID name and assign it to a variable.
thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
'<%=SimpleDDL.ClientID %>'
如果您使用.NET 4.0 则有一个控件属性
ClientIDMode="static"
,因此这将保留您提到的控件 id。In .NET when we use master page Id of control changes as you mentioned so we can get ID of control like
'<%=SimpleDDL.ClientID %>'
If you are using .NET 4.0 then there is an property of control
ClientIDMode="static"
so this will remain you control id as mentioned.