-1
我正在試圖找到每個data-id
,然後將它們打印到控制檯。如何獲取每個數據ID值
我試過如下:
$('.raffle-user-entries .raffle-user-entry').each(function() {
console.log($(this).find('raffle-user-entry-item').data('id'))
})
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="raffle-user-items">
<div class="raffle-user-item">
<div class="raffle-user-avatar">
<div class="raffle-user-avatar-box">
<a href="/steam/profile/76561198170191215" target="_blank">
<img src="/images/avatars/e369853df766fa44e1ed0ff613f563bd.jpg" original-title="Winner: tytyfhfh">
</a>
</div>
</div>
<div class="raffle-user-info">
<div class="raffle-user-info-item">
<div class="raffle-user-info-title">ID:</div>
<div class="raffle-user-info-value">224</div>
</div>
<div class="raffle-user-info-item">
<div class="raffle-user-info-title">Ended at:</div>
<div class="raffle-user-info-value">27.12.2016 06:32:21</div>
</div>
<div class="raffle-user-info-item">
<div class="raffle-user-info-title">Winning ticket:</div>
<div class="raffle-user-info-value"><i class="fa fa-ticket"></i> <span>4.762420565%</span>
</div>
</div>
<div class="raffle-user-info-item">
<div class="raffle-user-info-title">Secret:</div>
<div class="raffle-user-info-value"><i class="fa fa-star"></i> <span>12a5567c4e918e293debc5ae1bd6846da8595f1345306bc2efa28c6a4a07316a</span>
</div>
</div>
<div class="raffle-user-info-item">
<div class="raffle-user-info-title">Hash:</div>
<div class="raffle-user-info-value">814ba5c06847c1d4e78a5076c8222edf</div>
</div>
<div class="raffle-user-info-item">
<div class="raffle-user-info-title">Skins:</div>
<div class="raffle-user-info-value">19</div>
</div>
<div class="raffle-user-info-item">
<div class="raffle-user-info-title">Value:</div>
<div class="raffle-user-info-value">$1.44</div>
</div>
</div>
<div class="raffle-user-entries">
<div class="raffle-user-entries-title">Entries of winner</div>
<div class="raffle-user-entry">
<div class="raffle-user-entry-item">
<a href="https://steamcommunity.com/market/listings/730/Glove Case" target="_blank" original-title="Glove Case entered by tytyfhfh in entry #668 worth $0.48">
<img src="https://steamcommunity-a.akamaihd.net/economy/image/class/730/2066632015/100fx100f">
</a>
<a href="https://steamcommunity.com/market/listings/730/P250 | Valence (Field-Tested)" target="_blank" original-title="P250 | Valence (Field-Tested) entered by tytyfhfh in entry #668 worth $0.08">
<img src="https://steamcommunity-a.akamaihd.net/economy/image/class/730/937246119/100fx100f">
</a>
<a href="https://steamcommunity.com/market/listings/730/Gamma 2 Case" target="_blank" original-title="Gamma 2 Case entered by tytyfhfh in entry #668 worth $0.05">
<img src="https://steamcommunity-a.akamaihd.net/economy/image/class/730/1923037342/100fx100f">
</a>
<a href="https://steamcommunity.com/market/listings/730/Chroma 3 Case" target="_blank" original-title="Chroma 3 Case entered by tytyfhfh in entry #668 worth $0.03">
<img src="https://steamcommunity-a.akamaihd.net/economy/image/class/730/1690096482/100fx100f">
</a>
<a href="https://steamcommunity.com/market/listings/730/Chroma 3 Case" target="_blank" original-title="Chroma 3 Case entered by tytyfhfh in entry #668 worth $0.03">
<img src="https://steamcommunity-a.akamaihd.net/economy/image/class/730/1690096482/100fx100f">
</a>
<a href="https://steamcommunity.com/market/listings/730/Chroma 3 Case" target="_blank" original-title="Chroma 3 Case entered by tytyfhfh in entry #668 worth $0.03">
<img src="https://steamcommunity-a.akamaihd.net/economy/image/class/730/1690096482/100fx100f">
</a>
<a href="https://steamcommunity.com/market/listings/730/Chroma 2 Case" target="_blank" original-title="Chroma 2 Case entered by tytyfhfh in entry #668 worth $0.03">
<img src="https://steamcommunity-a.akamaihd.net/economy/image/class/730/926978479/100fx100f">
</a>
<a href="https://steamcommunity.com/market/listings/730/Revolver Case" target="_blank" original-title="Revolver Case entered by tytyfhfh in entry #668 worth $0.03">
<img src="https://steamcommunity-a.akamaihd.net/economy/image/class/730/1432174707/100fx100f">
</a>
<a href="https://steamcommunity.com/market/listings/730/Chroma 2 Case" target="_blank" original-title="Chroma 2 Case entered by tytyfhfh in entry #668 worth $0.03">
<img src="https://steamcommunity-a.akamaihd.net/economy/image/class/730/926978479/100fx100f">
</a>
</div>
</div>
<div class="raffle-user-entries-title">Entries of others</div>
<div class="raffle-user-entry">
<div class="raffle-user-entry-item">
<a href="https://steamcommunity.com/market/listings/730/XM1014 | Scumbria (Minimal Wear)" target="_blank" original-title="XM1014 | Scumbria (Minimal Wear) entered by TheSkiddelz in entry #669 worth $0.08">
<img src="https://steamcommunity-a.akamaihd.net/economy/image/class/730/1309989973/100fx100f">
</a>
<a href="https://steamcommunity.com/market/listings/730/XM1014 | Scumbria (Battle-Scarred)" target="_blank" original-title="XM1014 | Scumbria (Battle-Scarred) entered by TheSkiddelz in entry #669 worth $0.08">
<img src="https://steamcommunity-a.akamaihd.net/economy/image/class/730/1309988217/100fx100f">
</a>
<a href="https://steamcommunity.com/market/listings/730/SCAR-20 | Green Marine (Battle-Scarred)" target="_blank" original-title="SCAR-20 | Green Marine (Battle-Scarred) entered by TheSkiddelz in entry #669 worth $0.07">
<img src="https://steamcommunity-a.akamaihd.net/economy/image/class/730/1310001548/100fx100f">
</a>
<a href="https://steamcommunity.com/market/listings/730/Negev | Desert-Strike (Field-Tested)" target="_blank" original-title="Negev | Desert-Strike (Field-Tested) entered by TheSkiddelz in entry #669 worth $0.07">
<img src="https://steamcommunity-a.akamaihd.net/economy/image/class/730/520026696/100fx100f">
</a>
<a href="https://steamcommunity.com/market/listings/730/MAG-7 | Heaven Guard (Field-Tested)" target="_blank" original-title="MAG-7 | Heaven Guard (Field-Tested) entered by TheSkiddelz in entry #669 worth $0.07">
<img src="https://steamcommunity-a.akamaihd.net/economy/image/class/730/360453655/100fx100f">
</a>
<a href="https://steamcommunity.com/market/listings/730/Dual Berettas | Dualing Dragons (Battle-Scarred)" target="_blank" original-title="Dual Berettas | Dualing Dragons (Battle-Scarred) entered by TheSkiddelz in entry #669 worth $0.07">
<img src="https://steamcommunity-a.akamaihd.net/economy/image/class/730/1309989359/100fx100f">
</a>
<a href="https://steamcommunity.com/market/listings/730/XM1014 | Scumbria (Field-Tested)" target="_blank" original-title="XM1014 | Scumbria (Field-Tested) entered by TheSkiddelz in entry #669 worth $0.07">
<img src="https://steamcommunity-a.akamaihd.net/economy/image/class/730/1309998372/100fx100f">
</a>
<a href="https://steamcommunity.com/market/listings/730/Gamma 2 Case" target="_blank" original-title="Gamma 2 Case entered by TheSkiddelz in entry #669 worth $0.05">
<img src="https://steamcommunity-a.akamaihd.net/economy/image/class/730/1923037342/100fx100f">
</a>
<a style="background: #E1F5B0;border: 1px solid #B8CE81;" href="https://steamcommunity.com/market/listings/730/Gamma 2 Case" data-id="8527530651" target="_blank" original-title="Commisioned item: Gamma 2 Case entered by TheSkiddelz in entry #669 worth $0.05">
<img src="https://steamcommunity-a.akamaihd.net/economy/image/class/730/1923037342/100fx100f">
</a>
<a href="https://steamcommunity.com/market/listings/730/FAMAS | Cyanospatter (Minimal Wear)" target="_blank" original-title="FAMAS | Cyanospatter (Minimal Wear) entered by TheSkiddelz in entry #669 worth $0.04">
<img src="https://steamcommunity-a.akamaihd.net/economy/image/class/730/310780658/100fx100f">
</a>
</div>
</div>
</div>
</div>
<div class="raffle-user-item">
<div class="raffle-user-avatar">
<div class="raffle-user-avatar-box">
<a href="/steam/profile/76561198263286294" target="_blank">
<img src="/images/avatars/182be0c5cdcd5072bb1864cdee4d3d6e.jpg" original-title="Winner: TheSkiddelz">
</a>
</div>
</div>
<div class="raffle-user-info">
<div class="raffle-user-info-item">
<div class="raffle-user-info-title">ID:</div>
<div class="raffle-user-info-value">223</div>
</div>
<div class="raffle-user-info-item">
<div class="raffle-user-info-title">Ended at:</div>
<div class="raffle-user-info-value">27.12.2016 06:30:36</div>
</div>
<div class="raffle-user-info-item">
<div class="raffle-user-info-title">Winning ticket:</div>
<div class="raffle-user-info-value"><i class="fa fa-ticket"></i> <span>49.089895766%</span>
</div>
</div>
<div class="raffle-user-info-item">
<div class="raffle-user-info-title">Secret:</div>
<div class="raffle-user-info-value"><i class="fa fa-star"></i> <span>c2940ca49136ceee4b2bbc83c59041057af65254e11ae285039d38b8b3b5ca04</span>
</div>
</div>
<div class="raffle-user-info-item">
<div class="raffle-user-info-title">Hash:</div>
<div class="raffle-user-info-value">d3b184e107204cca29051e706cb68dff</div>
</div>
<div class="raffle-user-info-item">
<div class="raffle-user-info-title">Skins:</div>
<div class="raffle-user-info-value">5</div>
</div>
<div class="raffle-user-info-item">
<div class="raffle-user-info-title">Value:</div>
<div class="raffle-user-info-value">$0.29</div>
</div>
</div>
<div class="raffle-user-entries">
<div class="raffle-user-entries-title">Entries of winner</div>
<div class="raffle-user-entry">
<div class="raffle-user-entry-item">
<a href="https://steamcommunity.com/market/listings/730/XM1014 | Scumbria (Minimal Wear)" target="_blank" original-title="XM1014 | Scumbria (Minimal Wear) entered by TheSkiddelz in entry #666 worth $0.08">
<img src="https://steamcommunity-a.akamaihd.net/economy/image/class/730/1309989973/100fx100f">
</a>
<a href="https://steamcommunity.com/market/listings/730/XM1014 | Scumbria (Battle-Scarred)" target="_blank" original-title="XM1014 | Scumbria (Battle-Scarred) entered by TheSkiddelz in entry #666 worth $0.08">
<img src="https://steamcommunity-a.akamaihd.net/economy/image/class/730/1309988217/100fx100f">
</a>
<a href="https://steamcommunity.com/market/listings/730/XM1014 | Scumbria (Field-Tested)" target="_blank" original-title="XM1014 | Scumbria (Field-Tested) entered by TheSkiddelz in entry #666 worth $0.07">
<img src="https://steamcommunity-a.akamaihd.net/economy/image/class/730/1309998372/100fx100f">
</a>
</div>
</div>
<div class="raffle-user-entries-title">Entries of others</div>
<div class="raffle-user-entry">
<div class="raffle-user-entry-item">
<a href="https://steamcommunity.com/market/listings/730/Sealed Graffiti | Eat It (Cash Green)" target="_blank" original-title="Sealed Graffiti | Eat It (Cash Green) entered by tytyfhfh in entry #667 worth $0.03">
<img src="https://steamcommunity-a.akamaihd.net/economy/image/class/730/1989319524/100fx100f">
</a>
<a href="https://steamcommunity.com/market/listings/730/Sealed Graffiti | Rage Mode (Blood Red)" target="_blank" original-title="Sealed Graffiti | Rage Mode (Blood Red) entered by tytyfhfh in entry #667 worth $0.03">
<img src="https://steamcommunity-a.akamaihd.net/economy/image/class/730/1989285370/100fx100f">
</a>
</div>
</div>
</div>
</div>
</div>
當存儲的數據? –
替代「$(this).find('h3')。slideToggle('fast');」與「$(this).siblings(」h3「)。slideToggle('fast');」 –
哦,我很抱歉,我複製了錯誤的小提琴鏈接。 –