テーブル行のツールチップを表示するために 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 を選択しようとしましたが、うまくいきませんでした。
現在のホバー要素を選択できるセレクターが必要です...
ここで助けが得られることを願っています...フィードバックは大歓迎です...
ありがとう....