可以使用没有ID的jQuery吗?
我正在研究一段代码,在该代码中,似乎jQuery通过ID 访问一个元素,而没有 实际上具有ID的元素。以表格这是我所拥有的:
@Html.CheckBoxFor(Model => Model.IsEBSToBeCreated, new { disabled = "disabled", @checked = "checked" })
周围< div>
中没有ID,但是在脚本中,我看到了:
if ($("#ddlStatus option:selected").text() == 'Active') {
$("#IsEBSToBeCreated").prop("disabled", false);
}
如何使用 #isebstobecreated
而没有匹配的ID在 .cshtml
文件本身中。
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用@madreflection的提示,我查看了文档, html.checkboxfor ,实际上它可以生成一个输入元素
#isebstobecreated
id。Using the hint from @madreflection I looked at the documentation and markup generated by the
Html.CheckBoxFor
and indeed it generates an input element with an#IsEBSToBeCreated
ID.