テーブルの最後の行のデータ属性を取得するにはどうすればよいですか?
<tbody id="tableNotifications">
<tr class="notificationsRowEntry success" data-notification-timestamp="1384105387"></tr>
<tr class="notificationsRowEntry success" data-notification-timestamp="1384105367"></tr>
<tr class="notificationsRowEntry success" data-notification-timestamp="1384105357"></tr>
<tr class="notificationsRowEntry success" data-notification-timestamp="1384105323"></tr>
</tbody>
問題は、データ属性を取得できず、次を使用して最後のテーブル行のコンテンツのみを取得できることです:
$data = $("#tableNotifications").last().data("notification-timestamp");
愚かな間違いをしているのかもしれませんが、それは私を夢中にさせています.
ありがとうございました。
PS私はいくつかの一意のIDを追加してからデータを取得できることを知っています
$data = $(uniqueid).data("notification-timestamp");
しかし、私はそれを避けたいです。