我工作的一個項目,我想使用jQuery fadeOut
元素,具有鏈接data-code
等於1查找和淡出jQuery中
<a class="removebutton" title="Remove" data-code="1"></a>
<a class="removebutton" title="Remove" data-code="2"></a>
<a class="removebutton" title="Remove" data-code="3"></a>
<a class="removebutton" title="Remove" data-code="4"></a>
我試圖做到這一點,但我被困在這裏:
var itemsInBox = $(".contentwrapper .content .removebutton").find("data-code");
itemsInBox.fadeOut();
jQuery有方法與HTML5數據屬性的工作$( 「contentwrapper。內容.removebutton 」)的數據(「 代碼」); –