例如我有這樣的代碼選擇特殊的選擇
<script>
$(document).ready(function() {
$('span').each(function() {
$(this).html('<div></div>') ;
if ($(this).attr('id') == 'W0') { $(this > div ?!!!).text('0') }
if ($(this).attr('id') == 'W1') { $(this > div ?!!!).text('1') }
if ($(this).attr('id') == 'W2') { $(this > div ?!!!).text('2') }
});
});
</script>
<span id="W0"></span>
<span id="W1"></span>
<span id="W2"></span>
但$(this > div)
或$(this ' > div ')
是錯誤的選擇&不起作用
那麼什麼ü人建議我應該做的?