作者:的士风云 | 来源:互联网 | 2023-02-02 04:58
Iamtryingtoselecttheseelementsviauniqueid.Inthiscaseuniqueidis@item.cardID.我试图通过唯一I
I am trying to select these elements via unique id. In this case unique id is @item.cardID
.
我试图通过唯一ID选择这些元素。在这种情况下,唯一ID是@ item.cardID。
@model IEnumerable
foreach (var item in Model)
{
0 Spam
0 Loves
0 Favorites
0 Hates
}
I will have many links on a view page coming via list. I tried using jQuery with each anchor tag to post some data via ajax.
我将通过列表在视图页面上有许多链接。我尝试使用jQuery与每个锚标签通过ajax发布一些数据。
I would use unique id to use an ajax action on each anchor above.
我会使用唯一的id在上面的每个锚点上使用ajax动作。
I have already used id and class with name @item.cardID
and was using it as below before-
我已经使用名为@ item.cardID的id和类,并在之前使用它 -
for ID- $('#'+"@item.cardID")
for Class- $('.'+"@item.cardID")
Now for all left elements those should be using only unique id I have only left option is use it with the name. So I did try-
现在对于所有左侧元素,那些应该只使用唯一ID我只留下选项是使用它与名称。所以我试过 -
0 Spam
and jQuery now-
和jQuery现在 -
But this isn't working. How should I use this unique id without breaking action of other elements?
但这不起作用。如何在不破坏其他元素的情况下使用此唯一ID?
1 个解决方案