나는이 두 줄이 있습니다두 줄의 유사한 코드 중 하나는 작동하지만 다른 하나는 작동하지 않습니다. 왜 안돼?
이$target_box.children('a.ajax_trigger_title').addClass('opened_post_title');
jQuery('#'+$target_box.attr('id')+' a.ajax_trigger_title').addClass('opened_post_title');
첫 번째 줄은 작동하지 않습니다,하지만 두 번째는 않습니다. 왜? 당신이 알고 있어야하는 경우
여기에 관련 HTML입니다 :
<div class="box" id="30" style="position: absolute; left: 350px; top: 0px; margin-top: 10px; margin-right: 10px; margin-bottom: 10px; margin-left: 10px; ">
<h2>
<a class="ajax_trigger_title" id="open_30" href="http://keepskatinbro.com/2011/01/20/some-highlights-from-ksbs-throw-down-show-down/" rel="30">
<span>Highlights from KSB’s “Throw Down Show Down”.</span>
</a>
</h2>
</div>
$의 target_box는 ".box"
아, 알겠습니다! 거기에 더 많은 readble 코드를 갖는 의도를 위해'$ target_box.'로 시작되도록 라인 # 1을 다시 작성하는 것이 있습니까? – trusktr
@trusktr'children'을'find'로 대체하십시오. – Adeel