なぜこのコードは機能しませんか? また、最初のアイテムを選択する別の方法はありますか?私はこのような要素を選択することができます知っている要素の選択方法は?
<div>
<a href="#">text</a>
<a href="#">text</a>
</div>
<script type="text/javascript">
$(function() {
$('div a').each(function(){
$(':first', this).css('color', 'red');
//...other actions with $(this)
});
});
</script>
:各ループ内$('div a:first')
が)私は.each(の回避のために二回投票でき願いたいものです! –