我正在使用 qTip2 显示表格行的工具提示:
@foreach (var item in Model)
{
<tr id="@(item.ShopListID)">
<td id="name@(item.ShopListFoodID)" class="shoptablename">@Html.DisplayFor(modelItem => item.Name)
</td>
<td id="amnt@(item.ShopListFoodID)" class="shoptableamount">@Html.DisplayFor(modelItem => item.Amount)
</td>
</tr>
}
我想为每个“金额”字段提供工具提示,所以我像这样启动工具提示:
// Use ajax to add tooltip for food with stock amount
$('.shoptableamount').qtip($.extend({}, myStyle, {
content: {
text: 'Loading...', // The text to use whilst the AJAX request is loading
ajax: {
url: '/Shop/GetFoodAmount',
type: 'GET',
data: { id: $('.shoptableamount').attr('id') }
}
}
}));
但是,由于我选择使用该类,所以我只获得了第一个 tr 的 id,并且无论我将鼠标悬停在哪一行上,我仍然会获得一些工具提示内容作为第一行。我尝试使用 $(this) 来选择 id,但我没有工作。
我需要一个可以选择当前悬停元素的选择器...
希望可以在这里得到一些帮助...感谢任何反馈...
谢谢....